From bb0795ff855f2890bea3ceac05b6b2c4b0454d62 Mon Sep 17 00:00:00 2001 From: Ralf Habacker Date: Sun, 8 Nov 2015 14:47:19 +0100 Subject: [PATCH 2/2] Fix memory leaks in bus_activation_service_reload_test() in case of errors. Bug: https://bugs.freedesktop.org/show_bug.cgi?id=92721 --- bus/activation.c | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/bus/activation.c b/bus/activation.c index 3c3bd7a..1d5d741 100644 --- a/bus/activation.c +++ b/bus/activation.c @@ -2600,14 +2600,21 @@ bus_activation_service_reload_test (const DBusString *test_data_dir) tmp = _dbus_get_tmpdir (); if (tmp == NULL) - return FALSE; + { + _dbus_string_free (&directory); + return FALSE; + } if (!_dbus_string_append (&directory, tmp)) - return FALSE; + { + _dbus_string_free (&directory); + return FALSE; + } if (!_dbus_string_append (&directory, "/dbus-reload-test-") || !_dbus_generate_random_ascii (&directory, 6, NULL)) { + _dbus_string_free (&directory); return FALSE; } @@ -2631,7 +2638,10 @@ bus_activation_service_reload_test (const DBusString *test_data_dir) /* Cleanup test directory */ if (!cleanup_service_reload_test (&directory)) - return FALSE; + { + _dbus_string_free (&directory); + return FALSE; + } _dbus_string_free (&directory); -- 1.8.4.5