This commit is contained in:
Matěj Grabovský 2020-09-25 19:34:08 +02:00
parent 5c189cf957
commit dff3619715
2 changed files with 59 additions and 1 deletions

View File

@ -0,0 +1,53 @@
From ce557c0fb309184a9a8fc38a76404324d94803b0 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Mat=C4=9Bj=20Grabovsk=C3=BD?= <mgrabovs@redhat.com>
Date: Fri, 25 Sep 2020 19:23:51 +0200
Subject: [PATCH] gui-wizard-gtk: Fix a double free condition
We may only free `log_msg` in `update_command_run_log()` if it is the
result of the call to `g_strdup_printf()`, otherwise the caller takes
care of it.
Partially reverts 7aba6e53.
Resolves rhbz#1882319
---
src/gui-wizard-gtk/wizard.c | 12 +++++++++---
1 file changed, 9 insertions(+), 3 deletions(-)
diff --git a/src/gui-wizard-gtk/wizard.c b/src/gui-wizard-gtk/wizard.c
index 8a4486f2..a532c633 100644
--- a/src/gui-wizard-gtk/wizard.c
+++ b/src/gui-wizard-gtk/wizard.c
@@ -1385,7 +1385,7 @@ static void cancel_processing(GtkLabel *status_label, const char *message, int t
pango_attr_list_unref(list);
}
-static void update_command_run_log(const char* message, struct analyze_event_data *evd)
+static void update_command_run_log(char *message, struct analyze_event_data *evd)
{
const bool it_is_a_dot = (message[0] == '.' && message[1] == '\0');
@@ -1393,12 +1393,18 @@ static void update_command_run_log(const char* message, struct analyze_event_dat
gtk_label_set_text(g_lbl_event_log, message);
/* Don't append new line behind single dot */
- g_autofree const char *log_msg = it_is_a_dot ? message : g_strdup_printf("%s\n", message);
+ char *log_msg = it_is_a_dot ? message : g_strdup_printf("%s\n", message);
append_to_textview(g_tv_event_log, log_msg);
save_to_event_log(evd, log_msg);
+
+ if (log_msg != message)
+ {
+ /* We assume message is managed by the caller. */
+ free(log_msg);
+ }
}
-static void run_event_gtk_error(const char *error_line, void *param)
+static void run_event_gtk_error(char *error_line, void *param)
{
update_command_run_log(error_line, (struct analyze_event_data *)param);
}
--
2.26.2

View File

@ -15,11 +15,13 @@
Summary: Generic library for reporting various problems
Name: libreport
Version: 2.14.0
Release: 6%{?dist}
Release: 7%{?dist}
License: GPLv2+
URL: https://abrt.readthedocs.org/
Source: https://github.com/abrt/%{name}/archive/%{version}/%{name}-%{version}.tar.gz
Patch0: 0001-gui-wizard-gtk-Fix-a-double-free-condition.patch
BuildRequires: %{dbus_devel}
BuildRequires: gtk3-devel
BuildRequires: curl-devel
@ -659,6 +661,9 @@ gtk-update-icon-cache %{_datadir}/icons/hicolor &>/dev/null || :
%endif
%changelog
* Fri Sep 25 2020 Matěj Grabovský <mgrabovs@redhat.com> - 2.14.0-7
- Add fix for https://bugzilla.redhat.com/show_bug.cgi?id=1882319
* Wed Aug 19 2020 Merlin Mathesius <mmathesi@redhat.com> - 2.14.0-6
- Updates so ELN builds in a Fedora-like reporting configuration, even though
the %%{rhel} macro is set.