diff options
Diffstat (limited to 'backtrace-symbols.c')
-rw-r--r-- | backtrace-symbols.c | 6 |
1 files changed, 2 insertions, 4 deletions
diff --git a/backtrace-symbols.c b/backtrace-symbols.c index a8af6e4..aed39d6 100644 --- a/backtrace-symbols.c +++ b/backtrace-symbols.c @@ -45,6 +45,7 @@ #define false 0 #define _GNU_SOURCE +#include <alloca.h> #include <string.h> #include <stdio.h> #include <stdlib.h> @@ -328,11 +329,10 @@ char **backtrace_symbols(void *const *buffer, int size) /* discard calling function */ int total = 0; - char ***locations; char **final; char *f_strings; - locations = malloc(sizeof(char **) * (stack_depth+1)); + char ***const locations = alloca(sizeof(char **) * (stack_depth+1)); bfd_init(); for(x=stack_depth, y=0; x>=0; x--, y++){ @@ -363,7 +363,5 @@ char **backtrace_symbols(void *const *buffer, int size) f_strings += strlen(f_strings) + 1; } - free(locations); - return final; } |