Blob Blame Raw
From 9ada4ca561c6f81600f6002d7c672ce9959bd78f Mon Sep 17 00:00:00 2001
From: Jakub Filak <jfilak@redhat.com>
Date: Fri, 1 Aug 2014 16:13:35 +0200
Subject: [PATCH] koops: fix a use-after-free bug uncoverd by coverity

Signed-off-by: Jakub Filak <jfilak@redhat.com>
---
 src/plugins/abrt-action-analyze-oops.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/src/plugins/abrt-action-analyze-oops.c b/src/plugins/abrt-action-analyze-oops.c
index 1e94e43..f74ebcb 100644
--- a/src/plugins/abrt-action-analyze-oops.c
+++ b/src/plugins/abrt-action-analyze-oops.c
@@ -62,7 +62,6 @@ int main(int argc, char **argv)
     char *oops = dd_load_text(dd, FILENAME_BACKTRACE);
     char hash_str[SHA1_RESULT_LEN*2 + 1];
     int bad = koops_hash_str(hash_str, oops);
-    free(oops);
     if (bad)
     {
         error_msg("Can't find a meaningful backtrace for hashing in '%s'", dump_dir_name);
@@ -96,6 +95,8 @@ int main(int argc, char **argv)
         }
     }
 
+    free(oops);
+
     if (!bad)
     {
         dd_save_text(dd, FILENAME_UUID, hash_str);
-- 
1.9.3