diff options
author | Ralf Habacker <ralf.habacker@freenet.de> | 2015-11-11 15:02:00 +0100 |
---|---|---|
committer | Ralf Habacker <ralf.habacker@freenet.de> | 2015-11-11 15:02:00 +0100 |
commit | 52e97d76a6e3ffca8d0f949c9c322b8b4dd29ddd (patch) | |
tree | 48c11b7cd7d9c507ec8ed4b761283a6848f976f8 | |
parent | 1ca1bd2c536e75c94144842c84cb724b1d96c505 (diff) | |
download | dbus-52e97d76a6e3ffca8d0f949c9c322b8b4dd29ddd.tar.gz |
Fix memory leaks in bus_activation_service_reload_test() in case of errors.
Bug: https://bugs.freedesktop.org/show_bug.cgi?id=92721
Reviewed-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
-rw-r--r-- | bus/activation.c | 17 |
1 files changed, 9 insertions, 8 deletions
diff --git a/bus/activation.c b/bus/activation.c index 3c3bd7a5..7b1ab063 100644 --- a/bus/activation.c +++ b/bus/activation.c @@ -2593,6 +2593,7 @@ bus_activation_service_reload_test (const DBusString *test_data_dir) { DBusString directory; const char *tmp; + dbus_bool_t ret = FALSE; if (!_dbus_string_init (&directory)) return FALSE; @@ -2600,16 +2601,14 @@ bus_activation_service_reload_test (const DBusString *test_data_dir) tmp = _dbus_get_tmpdir (); if (tmp == NULL) - return FALSE; + goto out; if (!_dbus_string_append (&directory, tmp)) - return FALSE; + goto out; if (!_dbus_string_append (&directory, "/dbus-reload-test-") || !_dbus_generate_random_ascii (&directory, 6, NULL)) - { - return FALSE; - } + goto out; /* Do normal tests */ if (!init_service_reload_test (&directory)) @@ -2631,11 +2630,13 @@ bus_activation_service_reload_test (const DBusString *test_data_dir) /* Cleanup test directory */ if (!cleanup_service_reload_test (&directory)) - return FALSE; + goto out; - _dbus_string_free (&directory); + ret = TRUE; - return TRUE; +out: + _dbus_string_free (&directory); + return ret; } #endif /* DBUS_ENABLE_EMBEDDED_TESTS */ |