summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPetr Machata <pmachata@redhat.com>2013-11-11 02:27:08 +0100
committerChanho Park <chanho61.park@samsung.com>2014-08-22 20:38:23 +0900
commitd0d40630b921a3b54c35ff38be6f8e3fb13061cb (patch)
tree42e2a964fdd66ed49324df8e82970bd2d183aa5a
parente6c25f6799825812e2b87990333c649ba796f600 (diff)
downloadltrace-d0d40630b921a3b54c35ff38be6f8e3fb13061cb.tar.gz
ltrace-d0d40630b921a3b54c35ff38be6f8e3fb13061cb.tar.bz2
ltrace-d0d40630b921a3b54c35ff38be6f8e3fb13061cb.zip
In ltrace_init, don't call ltelf_destroy if ltelf_init fails
-rw-r--r--libltrace.c10
1 files changed, 7 insertions, 3 deletions
diff --git a/libltrace.c b/libltrace.c
index a8dd61e..2d910a1 100644
--- a/libltrace.c
+++ b/libltrace.c
@@ -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);