Commit 54c490ae authored by Uwe Schulzweida's avatar Uwe Schulzweida
Browse files

show_stackframe: free messages

parent 98bae580
......@@ -40,7 +40,7 @@ int main(void)
varID2 = vlistDefVar(vlistID, gridID, zaxisID2, TSTEP_INSTANT);
// Define the variable names
vlistDefVarName(vlistID, varID1, "varname1");
vlistDefVarName(vlistID*8, varID1, "varname1");
vlistDefVarName(vlistID, varID2, "varname2");
// Create a Time axis
......
......@@ -18,11 +18,13 @@ void show_stackframe()
{
#if defined (HAVE_EXECINFO_H)
void *trace[16];
size_t i;
size_t trace_size = backtrace(trace, 16);
char **messages = backtrace_symbols(trace, trace_size);
fprintf(stderr, "[bt] Execution path:\n");
for ( size_t i=0; i<trace_size; ++i ) fprintf(stderr, "[bt] %s\n", messages[i]);
for ( i = 0; i < trace_size; ++i ) fprintf(stderr, "[bt] %s\n", messages[i]);
if ( messages ) free(messages);
#endif
}
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment