1ab9d38
From 1f2963b0611d4023957abe3c7391eab86256ba82 Mon Sep 17 00:00:00 2001
1ab9d38
From: Michal Fabik <mfabik@redhat.com>
1ab9d38
Date: Wed, 23 Sep 2020 16:55:25 +0200
1ab9d38
Subject: [PATCH] hooklib: Don't g_autofree backtrace
1ab9d38
1ab9d38
The result of abrt_get_backtrace was being freed every time, even when
1ab9d38
no error occured.
1ab9d38
1ab9d38
Resolves:
1ab9d38
https://github.com/abrt/abrt/issues/1528
1ab9d38
https://bugzilla.redhat.com/show_bug.cgi?id=1881745
1ab9d38
Signed-off-by: Michal Fabik <mfabik@redhat.com>
1ab9d38
---
1ab9d38
 src/lib/hooklib.c | 3 ++-
1ab9d38
 1 file changed, 2 insertions(+), 1 deletion(-)
1ab9d38
1ab9d38
diff --git a/src/lib/hooklib.c b/src/lib/hooklib.c
1ab9d38
index dceaeb16..56b77bc3 100644
1ab9d38
--- a/src/lib/hooklib.c
1ab9d38
+++ b/src/lib/hooklib.c
1ab9d38
@@ -348,7 +348,7 @@ char *abrt_get_backtrace(struct dump_dir *dd, unsigned timeout_sec, const char *
1ab9d38
     unsigned bt_depth = 1024;
1ab9d38
     const char *thread_apply_all = "thread apply all -ascending";
1ab9d38
     const char *full = "full ";
1ab9d38
-    g_autofree char *bt = NULL;
1ab9d38
+    char *bt = NULL;
1ab9d38
     while (1)
1ab9d38
     {
1ab9d38
         args[bt_cmd_index] = g_strdup_printf("%s backtrace %s%u", thread_apply_all, full, bt_depth);
1ab9d38
@@ -367,6 +367,7 @@ char *abrt_get_backtrace(struct dump_dir *dd, unsigned timeout_sec, const char *
1ab9d38
             /* (NB: in fact, current impl. of exec_vp() never returns NULL) */
1ab9d38
             log_warning("Failed to generate backtrace, reducing depth to %u",
1ab9d38
                         bt_depth);
1ab9d38
+            free(bt);
1ab9d38
 
1ab9d38
         /* Replace -ex disassemble (which disasms entire function $pc points to)
1ab9d38
          * to a version which analyzes limited, small patch of code around $pc.
1ab9d38
-- 
1ab9d38
2.26.2
1ab9d38