test_command_line_internal: Fix variable original_argv going out of scope leaks the...
authorRalf Habacker <ralf.habacker@freenet.de>
Tue, 21 Apr 2015 12:14:26 +0000 (14:14 +0200)
committerRalf Habacker <ralf.habacker@freenet.de>
Fri, 1 May 2015 21:05:14 +0000 (23:05 +0200)
Reported by Coverity: CID 60588: Resource leak (RESOURCE_LEAK)

Bug: https://bugs.freedesktop.org/show_bug.cgi?id=90021
Reviewed-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
test/shell-test.c

index 1938379..61280d6 100644 (file)
@@ -93,15 +93,15 @@ test_command_line_internal (dbus_bool_t should_work,
       dbus_free_string_array (shell_argv);
     }
 
+  _dbus_string_free (&str);
+  dbus_free (original_argv);
+
   if (!should_work)
     {
       printf ("# Expected an error\n");
       return FALSE;
     }
 
-  _dbus_string_free (&str);
-  dbus_free (original_argv);
-
   return TRUE;
 }