Blob Blame History Raw
From b28fcc053db224c11f1f88d2885eba88d60a7322 Mon Sep 17 00:00:00 2001
From: Ernestas Kulik <ekulik@redhat.com>
Date: Tue, 28 Jul 2020 15:39:43 +0200
Subject: [PATCH] applet: application: Fix crash when processing deferred

Currently, when processing the deferred problems, if reporting fails,
the problem is re-added to the queue, but the object is not
re-referenced, leading to invalid reads later on.
---
 src/applet/abrt-applet-application.c | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/src/applet/abrt-applet-application.c b/src/applet/abrt-applet-application.c
index 28e55135..4716524b 100644
--- a/src/applet/abrt-applet-application.c
+++ b/src/applet/abrt-applet-application.c
@@ -771,11 +771,9 @@ handle_event_output_cb (GIOChannel   *gio,
                         gpointer      data)
 {
     EventProcessingState *state;
-    AbrtAppletProblemInfo *problem_info;
     int status;
 
     state = data;
-    problem_info = state->problem_info;
 
     /* Read streamed data and split lines */
     for (;;)
@@ -836,21 +834,23 @@ handle_event_output_cb (GIOChannel   *gio,
 
     if (WIFEXITED (status) && WEXITSTATUS (status) == EXIT_STOP_EVENT_RUN)
     {
-        abrt_applet_problem_info_set_known (problem_info, true);
+        abrt_applet_problem_info_set_known (state->problem_info, true);
         status = 0;
     }
 
     if (status == 0)
     {
-        abrt_applet_problem_info_set_reported (problem_info, true);
+        abrt_applet_problem_info_set_reported (state->problem_info, true);
 
         log_debug ("fast report finished successfully");
-        abrt_applet_application_send_problem_notification (state->application, problem_info);
+        abrt_applet_application_send_problem_notification (state->application,
+                                                           state->problem_info);
     }
     else
     {
         log_debug ("fast report failed, deferring");
-        g_ptr_array_add (state->application->deferred_problems, problem_info);
+        g_ptr_array_add (state->application->deferred_problems,
+                         g_steal_pointer (&state->problem_info));
     }
 
     event_processing_state_free (state);
-- 
2.26.2