In ltrace_init, don't call ltelf_destroy if ltelf_init fails
authorPetr Machata <pmachata@redhat.com>
Mon, 11 Nov 2013 01:27:08 +0000 (02:27 +0100)
committerChanho Park <chanho61.park@samsung.com>
Fri, 22 Aug 2014 11:38:23 +0000 (20:38 +0900)
libltrace.c

index a8dd61e..2d910a1 100644 (file)
@@ -116,9 +116,13 @@ ltrace_init(int argc, char **argv)
        if (command) {
                /* Check that the binary ABI is supported before
                 * calling execute_program.  */
-               struct ltelf lte;
-               ltelf_init(&lte, command);
-               ltelf_destroy(&lte);
+               {
+                       struct ltelf lte;
+                       if (ltelf_init(&lte, command) == 0)
+                               ltelf_destroy(&lte);
+                       else
+                               exit(EXIT_FAILURE);
+               }
 
                pid_t pid = execute_program(command, argv);
                struct process *proc = open_program(command, pid);