libreport/0006-event_config-Null-autofree-pointers-before-returning.patch
Matěj Grabovský 11466005e0 Add upstream patches for memory management
Add patch for rhbz#1883337 and rhbz#1883410.
2020-09-29 16:15:42 +02:00

41 lines
1.2 KiB
Diff

From 41b6477bdeaa82c647db2f1c2ba1132c77b365ed Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Mat=C4=9Bj=20Grabovsk=C3=BD?= <mgrabovs@redhat.com>
Date: Tue, 29 Sep 2020 14:43:15 +0200
Subject: [PATCH 2/2] event_config: Null autofree pointers before returning
The pointers to strings in the function check_problem_rating_usability()
need to be nullified before the function returns as they are declared
for auto-cleanup.
This change fixes a double-free condition in which the returned strings
were attempted to be freed again in the caller,
is_backtrace_rating_usable().
Bug was introduced in 05e9c9273.
Resolves rhbz#1883410
---
src/lib/event_config.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/src/lib/event_config.c b/src/lib/event_config.c
index c8053b7c..01e91efe 100644
--- a/src/lib/event_config.c
+++ b/src/lib/event_config.c
@@ -541,10 +541,10 @@ bool check_problem_rating_usability(const event_config_t *cfg,
finish:
if (description)
- *description = tmp_desc;
+ *description = g_steal_pointer(&tmp_desc);
if (detail)
- *detail = tmp_detail;
+ *detail = g_steal_pointer(&tmp_detail);
return result;
}
--
2.26.2