From 3bc6840b04108d895ec3962ed5933bb0edb20cf4 Mon Sep 17 00:00:00 2001 From: Ray Strode Date: Tue, 15 Jul 2008 04:01:49 -0400 Subject: 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. --- bus/activation.c | 7 +++++-- 1 file 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; } -- cgit