]> git.ipfire.org Git - thirdparty/dbus.git/commitdiff
Fix leaks in bus_activation_get_environment error paths
authorRay Strode <rstrode@redhat.com>
Tue, 15 Jul 2008 08:01:49 +0000 (04:01 -0400)
committerRay Strode <rstrode@redhat.com>
Tue, 15 Jul 2008 08:01:49 +0000 (04:01 -0400)
Commit 91306ef938873fce8f2ae2d4a6b3282d0379c65a introduced
two memory leaks on OOM error paths.  In one case the
environment string array wasn't getting freed, and in the
other case it was getting freed with dbus_free instead of
dbus_free_string_array.

bus/activation.c

index b895d9fdc0156947fcd2af9c3471f5c4ac15bf23..1863095881f7a455671c93871278dc51bf95e610 100644 (file)
@@ -1498,7 +1498,10 @@ bus_activation_get_environment (BusActivation *activation)
   _dbus_hash_iter_init (activation->environment, &iter);
 
   if (!_dbus_string_init (&entry))
-    return NULL;
+    {
+      dbus_free_string_array (environment);
+      return NULL;
+    }
 
   while (_dbus_hash_iter_next (&iter))
     {
@@ -1519,7 +1522,7 @@ bus_activation_get_environment (BusActivation *activation)
 
   if (i != length)
     {
-      dbus_free (environment);
+      dbus_free_string_array (environment);
       environment = NULL;
     }