summaryrefslogtreecommitdiff
path: root/vcl
diff options
context:
space:
mode:
authorMatthew J. Francis <mjay.francis@gmail.com>2014-09-18 18:33:00 +0800
committerTor Lillqvist <tml@collabora.com>2014-09-18 12:59:32 +0000
commit7fc08970894aea2b771bf7be409b72845c96d10a (patch)
treeeb7b3ce5a6a0d68271e66a403a7118609da63f7d /vcl
parenta1740a682a6c46c57dc6a356299f6c9a92eb4af6 (diff)
fdo#69090 Avoid using a string after free
Change-Id: I9020b595e434b4de8aa6a14c20d6c98fa619b96a Reviewed-on: https://gerrit.libreoffice.org/11502 Reviewed-by: Tor Lillqvist <tml@collabora.com> Tested-by: Tor Lillqvist <tml@collabora.com>
Diffstat (limited to 'vcl')
-rw-r--r--vcl/unx/gtk/window/gtksalmenu.cxx6
1 files changed, 5 insertions, 1 deletions
diff --git a/vcl/unx/gtk/window/gtksalmenu.cxx b/vcl/unx/gtk/window/gtksalmenu.cxx
index 05563a139d36..66225454c84a 100644
--- a/vcl/unx/gtk/window/gtksalmenu.cxx
+++ b/vcl/unx/gtk/window/gtksalmenu.cxx
@@ -702,7 +702,11 @@ GtkSalMenu* GtkSalMenu::GetMenuForItemCommand( gchar* aCommand, gboolean bGetSub
GtkSalMenuItem *pSalItem = maItems[ nPos ];
OUString aItemCommand = mpVCLMenu->GetItemCommand( pSalItem->mnId );
- gchar* aItemCommandStr = (gchar*) OUStringToOString( aItemCommand, RTL_TEXTENCODING_UTF8 ).getStr();
+ // Do not join the following two lines, or the OString will be destroyed
+ // immediately, and the gchar* pointed to by aItemCommandStr will be
+ // freed before it can be used - fdo#69090
+ OString aItemCommandOStr = OUStringToOString( aItemCommand, RTL_TEXTENCODING_UTF8 );
+ gchar* aItemCommandStr = (gchar*) aItemCommandOStr.getStr();
if ( g_strcmp0( aItemCommandStr, aCommand ) == 0 )
{