gstinfo: Fix leak in generate_backtrace_trace

Spotted by Laurent Pinchart.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/901>
This commit is contained in:
Nicolas Dufresne 2021-09-24 08:19:51 -04:00 committed by GStreamer Marge Bot
parent 2546cef4be
commit d4bcff7dab

View file

@ -2942,7 +2942,6 @@ generate_backtrace_trace (void)
char **strings;
GString *trace;
trace = g_string_new (NULL);
nptrs = backtrace (buffer, BT_BUF_SIZE);
strings = backtrace_symbols (buffer, nptrs);
@ -2950,6 +2949,8 @@ generate_backtrace_trace (void)
if (!strings)
return NULL;
trace = g_string_new (NULL);
for (j = 0; j < nptrs; j++)
g_string_append_printf (trace, "%s\n", strings[j]);