Commit 52e97d76 authored by Ralf Habacker's avatar Ralf Habacker

Fix memory leaks in bus_activation_service_reload_test() in case of errors.

Bug: https://bugs.freedesktop.org/show_bug.cgi?id=92721Reviewed-by: default avatarSimon McVittie <simon.mcvittie@collabora.co.uk>
parent 1ca1bd2c
...@@ -2593,6 +2593,7 @@ bus_activation_service_reload_test (const DBusString *test_data_dir) ...@@ -2593,6 +2593,7 @@ bus_activation_service_reload_test (const DBusString *test_data_dir)
{ {
DBusString directory; DBusString directory;
const char *tmp; const char *tmp;
dbus_bool_t ret = FALSE;
if (!_dbus_string_init (&directory)) if (!_dbus_string_init (&directory))
return FALSE; return FALSE;
...@@ -2600,16 +2601,14 @@ bus_activation_service_reload_test (const DBusString *test_data_dir) ...@@ -2600,16 +2601,14 @@ bus_activation_service_reload_test (const DBusString *test_data_dir)
tmp = _dbus_get_tmpdir (); tmp = _dbus_get_tmpdir ();
if (tmp == NULL) if (tmp == NULL)
return FALSE; goto out;
if (!_dbus_string_append (&directory, tmp)) if (!_dbus_string_append (&directory, tmp))
return FALSE; goto out;
if (!_dbus_string_append (&directory, "/dbus-reload-test-") || if (!_dbus_string_append (&directory, "/dbus-reload-test-") ||
!_dbus_generate_random_ascii (&directory, 6, NULL)) !_dbus_generate_random_ascii (&directory, 6, NULL))
{ goto out;
return FALSE;
}
/* Do normal tests */ /* Do normal tests */
if (!init_service_reload_test (&directory)) if (!init_service_reload_test (&directory))
...@@ -2631,11 +2630,13 @@ bus_activation_service_reload_test (const DBusString *test_data_dir) ...@@ -2631,11 +2630,13 @@ bus_activation_service_reload_test (const DBusString *test_data_dir)
/* Cleanup test directory */ /* Cleanup test directory */
if (!cleanup_service_reload_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 */ #endif /* DBUS_ENABLE_EMBEDDED_TESTS */
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment