From 459866876745b2abcd8fa8e7176ee758e75e0c71 Mon Sep 17 00:00:00 2001 From: Vedran Ljubovic Date: Sat, 26 Aug 2006 15:13:50 +0000 Subject: [PATCH] Fix buffer allocation that disabled showing backtrace --- elauncher/elauncher.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/elauncher/elauncher.cpp b/elauncher/elauncher.cpp index b357ddf..c011b5c 100755 --- a/elauncher/elauncher.cpp +++ b/elauncher/elauncher.cpp @@ -188,10 +188,11 @@ bool get_me_gdb_output(int crashpid) { // child char *argv[4]; + char tmp[1000]; argv[0] = "sh"; argv[1] = "-c"; - argv[2] = (char*)malloc(1000); // Who should free(argv[2]) ? - snprintf (argv[2], sizeof(argv[2])-1, "echo bt>/tmp/gdbbatch; echo q>>/tmp/gdbbatch; "GDBPATH" %s --core core.%d --command /tmp/gdbbatch --quiet > /tmp/gdboutput", cmd_, crashpid); + argv[2] = tmp; + snprintf (argv[2], 999, "echo bt>/tmp/gdbbatch; echo q>>/tmp/gdbbatch; "GDBPATH" %s --core core.%d --command /tmp/gdbbatch --quiet > /tmp/gdboutput", cmd_, crashpid); argv[3] = NULL; if (execve ("/bin/sh", argv, environ) == -1)