summaryrefslogtreecommitdiffstats
path: root/memstomp.c
diff options
context:
space:
mode:
Diffstat (limited to 'memstomp.c')
-rw-r--r--memstomp.c6
1 files changed, 1 insertions, 5 deletions
diff --git a/memstomp.c b/memstomp.c
index 01577eb..7339872 100644
--- a/memstomp.c
+++ b/memstomp.c
@@ -218,14 +218,12 @@ static bool verify_frame(const char *s) {
}
static char* generate_stacktrace(void) {
- void **buffer;
char **strings, *ret, *p;
int n, i;
size_t k;
bool b;
- buffer = malloc(sizeof(void*) * frames_max);
- assert(buffer);
+ void **const buffer = alloca(sizeof(void*) * frames_max);
n = real_backtrace(buffer, frames_max);
assert(n >= 0);
@@ -233,8 +231,6 @@ static char* generate_stacktrace(void) {
strings = real_backtrace_symbols(buffer, n);
assert(strings);
- free(buffer);
-
k = 0;
for (i = 0; i < n; i++)
k += strlen(strings[i]) + 2;