summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRay Strode <rstrode@redhat.com>2008-07-15 04:01:49 -0400
committerRay Strode <rstrode@redhat.com>2008-07-15 04:01:49 -0400
commit3bc6840b04108d895ec3962ed5933bb0edb20cf4 (patch)
tree39960ffc7e11507a20be0dff0ba67f341e27bdc9
parent01e50bcd5d06c3ffdf6a78036d7b1ea8f9ad0762 (diff)
Fix leaks in bus_activation_get_environment error paths
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.
-rw-r--r--bus/activation.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/bus/activation.c b/bus/activation.c
index b895d9fd..18630958 100644
--- a/bus/activation.c
+++ b/bus/activation.c
@@ -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;
}