Kaydet (Commit) 7fc08970 authored tarafından Matthew J. Francis's avatar Matthew J. Francis Kaydeden (comit) Tor Lillqvist

fdo#69090 Avoid using a string after free

Change-Id: I9020b595e434b4de8aa6a14c20d6c98fa619b96a
Reviewed-on: https://gerrit.libreoffice.org/11502Reviewed-by: 's avatarTor Lillqvist <tml@collabora.com>
Tested-by: 's avatarTor Lillqvist <tml@collabora.com>
üst a1740a68
......@@ -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 )
{
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment