Package: gnome-session
Version: 2.26.1-6
Tags: confirmed,patch,upstream

Hi, this bug is caused by recent upstream changes in
egg/eggdesktopfile.c in function egg_desktop_file_launch(). This
function tries to launch autorun apps defined in desktop files. In case
the desktop file cannot be properly parsed (returned value of function
parse_exec is NULL) all the "launch" stuff is skipped and only cleanup
code is executed (the "out" label). In this cleanup block we try to
free an array of strings (env->pdata) that must be NULL terminated (because we
use g_strfreev()) and  in the case the parsing of desktop file failed
it is simple not NULL terminated array because we skipped the code that adds
NULL to the end of array.

Attached patch simply reverts recent changes from freeing strings of env
array to free each of its string in sequence by calling
g_ptr_array_foreach (env,(GFunc)g_free, NULL) and then free the
remaining array of pointers.

... fill env array ...
.
.
#1199
  command = parse_exec (desktop_file, &docs, error);
  if (!command)
        goto out;
.
.
if (env != NULL)
        g_ptr_array_add (env, NULL);
.
.
#1274 
out:
  if (env)
    {
      g_strfreev ((char **)env->pdata);
      g_ptr_array_free (env, FALSE);
    }
.

should be:
 out:
   if (env)
     {
      g_ptr_array_foreach (env, (GFunc)g_free, NULL);
      g_ptr_array_free (env, TRUE);
     }

Cheers,
Petr
--- egg/eggdesktopfile.c	2009-04-14 15:31:45.000000000 +0000
+++ egg/eggdesktopfile.c-new	2009-06-14 19:49:19.000000000 +0000
@@ -1274,8 +1274,8 @@
  out:
   if (env)
     {
-      g_strfreev ((char **)env->pdata);
-      g_ptr_array_free (env, FALSE);
+      g_ptr_array_foreach (env, (GFunc)g_free, NULL);
+      g_ptr_array_free (env, TRUE);
     }
   free_document_list (translated_documents);
 

Reply via email to