609473e
From cf78b299371995cbd7607a536f4b1469c09b40cf Mon Sep 17 00:00:00 2001
609473e
From: Ernestas Kulik <ekulik@redhat.com>
609473e
Date: Sat, 12 Jan 2019 10:50:24 +0100
609473e
Subject: [PATCH] applet: application: Fix use after free
609473e
MIME-Version: 1.0
609473e
Content-Type: text/plain; charset=UTF-8
609473e
Content-Transfer-Encoding: 8bit
609473e
609473e
dirlist_name is erroneously freed before it’s used to create a
609473e
directory.
609473e
609473e
Fixes https://bugzilla.redhat.com/show_bug.cgi?id=1665521
609473e
609473e
Signed-off-by: Ernestas Kulik <ekulik@redhat.com>
609473e
---
609473e
 src/applet/abrt-applet-application.c | 4 ++--
609473e
 1 file changed, 2 insertions(+), 2 deletions(-)
609473e
609473e
diff --git a/src/applet/abrt-applet-application.c b/src/applet/abrt-applet-application.c
609473e
index 6e7ac00a..4b1d9a3c 100644
609473e
--- a/src/applet/abrt-applet-application.c
609473e
+++ b/src/applet/abrt-applet-application.c
609473e
@@ -296,10 +296,10 @@ new_dir_exists (GList **new_dirs)
609473e
     cachedir = g_get_user_cache_dir ();
609473e
     dirlist_name = concat_path_file (cachedir, "abrt");
609473e
 
609473e
-    g_free (dirlist_name);
609473e
-
609473e
     g_mkdir_with_parents (dirlist_name, 0777);
609473e
 
609473e
+    g_free (dirlist_name);
609473e
+
609473e
     dirlist_name = concat_path_file (cachedir, "abrt/applet_dirlist");
609473e
     fp = fopen (dirlist_name, "r+");
609473e
     if (fp == NULL)
609473e
-- 
609473e
2.20.1
609473e