Blame 0003-applet-application-Fix-crash-when-processing-deferre.patch

935456c
From b28fcc053db224c11f1f88d2885eba88d60a7322 Mon Sep 17 00:00:00 2001
935456c
From: Ernestas Kulik <ekulik@redhat.com>
935456c
Date: Tue, 28 Jul 2020 15:39:43 +0200
935456c
Subject: [PATCH] applet: application: Fix crash when processing deferred
935456c
935456c
Currently, when processing the deferred problems, if reporting fails,
935456c
the problem is re-added to the queue, but the object is not
935456c
re-referenced, leading to invalid reads later on.
935456c
---
935456c
 src/applet/abrt-applet-application.c | 12 ++++++------
935456c
 1 file changed, 6 insertions(+), 6 deletions(-)
935456c
935456c
diff --git a/src/applet/abrt-applet-application.c b/src/applet/abrt-applet-application.c
935456c
index 28e55135..4716524b 100644
935456c
--- a/src/applet/abrt-applet-application.c
935456c
+++ b/src/applet/abrt-applet-application.c
935456c
@@ -771,11 +771,9 @@ handle_event_output_cb (GIOChannel   *gio,
935456c
                         gpointer      data)
935456c
 {
935456c
     EventProcessingState *state;
935456c
-    AbrtAppletProblemInfo *problem_info;
935456c
     int status;
935456c
 
935456c
     state = data;
935456c
-    problem_info = state->problem_info;
935456c
 
935456c
     /* Read streamed data and split lines */
935456c
     for (;;)
935456c
@@ -836,21 +834,23 @@ handle_event_output_cb (GIOChannel   *gio,
935456c
 
935456c
     if (WIFEXITED (status) && WEXITSTATUS (status) == EXIT_STOP_EVENT_RUN)
935456c
     {
935456c
-        abrt_applet_problem_info_set_known (problem_info, true);
935456c
+        abrt_applet_problem_info_set_known (state->problem_info, true);
935456c
         status = 0;
935456c
     }
935456c
 
935456c
     if (status == 0)
935456c
     {
935456c
-        abrt_applet_problem_info_set_reported (problem_info, true);
935456c
+        abrt_applet_problem_info_set_reported (state->problem_info, true);
935456c
 
935456c
         log_debug ("fast report finished successfully");
935456c
-        abrt_applet_application_send_problem_notification (state->application, problem_info);
935456c
+        abrt_applet_application_send_problem_notification (state->application,
935456c
+                                                           state->problem_info);
935456c
     }
935456c
     else
935456c
     {
935456c
         log_debug ("fast report failed, deferring");
935456c
-        g_ptr_array_add (state->application->deferred_problems, problem_info);
935456c
+        g_ptr_array_add (state->application->deferred_problems,
935456c
+                         g_steal_pointer (&state->problem_info));
935456c
     }
935456c
 
935456c
     event_processing_state_free (state);
935456c
-- 
935456c
2.26.2
935456c