From: Ray Strode Date: Tue, 15 Jul 2008 08:01:49 +0000 (-0400) Subject: Fix leaks in bus_activation_get_environment error paths X-Git-Tag: dbus-1.2.3~6^2 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=3bc6840b04108d895ec3962ed5933bb0edb20cf4;p=thirdparty%2Fdbus.git 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. --- diff --git a/bus/activation.c b/bus/activation.c index b895d9fdc..186309588 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; }