From fb7c185e1ad95e970f1bd1611c6df4597e61d803 Mon Sep 17 00:00:00 2001 From: Ralf Habacker Date: Tue, 10 Nov 2015 22:18:16 +0100 Subject: [PATCH] shell-test: Calling _dbus_string_init without checking return value (CID 60587). Reported by Coverity: CID 60587: Unchecked return value (CHECKED_RETURN) Bug: https://bugs.freedesktop.org/show_bug.cgi?id=90021 --- test/shell-test.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/test/shell-test.c b/test/shell-test.c index 61280d6..6fa7a88 100644 --- a/test/shell-test.c +++ b/test/shell-test.c @@ -36,7 +36,13 @@ test_command_line_internal (dbus_bool_t should_work, original_argc = _dbus_list_get_length (&list); original_argv = dbus_new (char *, original_argc); - _dbus_string_init (&str); + if (!_dbus_string_init (&str)) + { + _dbus_list_clear (&list); + dbus_free (original_argv); + return FALSE; + } + for (i = 0, node = _dbus_list_get_first_link (&list); i < original_argc && node; i++, node = _dbus_list_get_next_link (&list, node)) { @@ -57,6 +63,7 @@ test_command_line_internal (dbus_bool_t should_work, should_work ? "" : " (as expected)", error.message ? error.message : ""); dbus_free (original_argv); + _dbus_string_free (&str); return !should_work; } else -- 1.8.4.5