update_desktop_file_entry: make scope of exec_tmp as short as possible
authorSimon McVittie <simon.mcvittie@collabora.co.uk>
Fri, 14 Jan 2011 17:59:24 +0000 (17:59 +0000)
committerSimon McVittie <simon.mcvittie@collabora.co.uk>
Wed, 16 Feb 2011 14:47:08 +0000 (14:47 +0000)
Bug: https://bugs.freedesktop.org/show_bug.cgi?id=33126

bus/activation.c

index 0721704..af02825 100644 (file)
@@ -310,6 +310,10 @@ update_desktop_file_entry (BusActivation       *activation,
                                     error))
     goto failed;
 
+  exec = _dbus_strdup (_dbus_replace_install_prefix (exec_tmp));
+  dbus_free (exec_tmp);
+  exec_tmp = NULL;
+
   /* user is not _required_ unless we are using system activation */
   if (!bus_desktop_file_get_string (desktop_file,
                                     DBUS_SERVICE_SECTION,
@@ -360,8 +364,6 @@ update_desktop_file_entry (BusActivation       *activation,
   entry = _dbus_hash_table_lookup_string (s_dir->entries,
                                           _dbus_string_get_const_data (filename));
 
-  exec = _dbus_strdup (_dbus_replace_install_prefix (exec_tmp));
-
   if (entry == NULL) /* New file */
     {
       /* FIXME we need a better-defined algorithm for which service file to
@@ -453,7 +455,6 @@ update_desktop_file_entry (BusActivation       *activation,
 
 failed:
   dbus_free (name);
-  dbus_free (exec_tmp);
   dbus_free (user);
   dbus_free (systemd_service);
   _dbus_string_free (&file_path);