Blame createrepo_c-0.10.0-ignorelock-doublefree.patch

6a445f4
From 3519f493ce51bac53d178f7ff9e5b84ca98a158a Mon Sep 17 00:00:00 2001
6a445f4
From: Tomas Mlcoch <tmlcoch@redhat.com>
6a445f4
Date: Fri, 19 Aug 2016 14:59:26 +0200
6a445f4
Subject: [PATCH 1/2] cr_lock_repo: Fix segfault caused by freed
6a445f4
 tmp_repodata_dir variable
6a445f4
6a445f4
---
6a445f4
 src/createrepo_shared.c | 5 ++---
6a445f4
 1 file changed, 2 insertions(+), 3 deletions(-)
6a445f4
6a445f4
diff --git a/src/createrepo_shared.c b/src/createrepo_shared.c
6a445f4
index 5872029..d4df86c 100644
6a445f4
--- a/src/createrepo_shared.c
6a445f4
+++ b/src/createrepo_shared.c
6a445f4
@@ -258,12 +258,11 @@ cr_lock_repo(const gchar *repo_dir,
6a445f4
             g_debug("(--ignore-lock enabled) For data generation is used: %s",
6a445f4
                     tmp_repodata_dir);
6a445f4
         }
6a445f4
-    }
6a445f4
 
6a445f4
-    if (tmp_repodata_dir)
6a445f4
         *tmp_repodata_dir_p = g_strdup(tmp_repodata_dir);
6a445f4
-    else
6a445f4
+    } else {
6a445f4
         *tmp_repodata_dir_p = g_strdup(lock_dir);
6a445f4
+    }
6a445f4
 
6a445f4
     return TRUE;
6a445f4
 }
6a445f4
-- 
6a445f4
2.9.3
6a445f4
6a445f4
6a445f4
From 07f5cce3eff5c62f0c16143c7eaab64eb0e3ebf8 Mon Sep 17 00:00:00 2001
6a445f4
From: Tomas Mlcoch <tmlcoch@redhat.com>
6a445f4
Date: Thu, 8 Sep 2016 09:45:38 +0200
6a445f4
Subject: [PATCH 2/2] cr_lock_repo: Fix double free (RhBz: 1355720)
6a445f4
6a445f4
---
6a445f4
 src/createrepo_shared.c | 8 ++++----
6a445f4
 1 file changed, 4 insertions(+), 4 deletions(-)
6a445f4
6a445f4
diff --git a/src/createrepo_shared.c b/src/createrepo_shared.c
6a445f4
index d4df86c..8a26787 100644
6a445f4
--- a/src/createrepo_shared.c
6a445f4
+++ b/src/createrepo_shared.c
6a445f4
@@ -188,7 +188,6 @@ cr_lock_repo(const gchar *repo_dir,
6a445f4
     assert(!err || *err == NULL);
6a445f4
 
6a445f4
     _cleanup_free_ gchar *lock_dir = NULL;
6a445f4
-    _cleanup_free_ gchar *tmp_repodata_dir = NULL;
6a445f4
     _cleanup_error_free_ GError *tmp_err = NULL;
6a445f4
 
6a445f4
     lock_dir = g_build_filename(repo_dir, ".repodata/", NULL);
6a445f4
@@ -242,10 +241,11 @@ cr_lock_repo(const gchar *repo_dir,
6a445f4
         }
6a445f4
 
6a445f4
         // To data generation use a different one
6a445f4
+        _cleanup_free_ gchar *tmp_repodata_dir = NULL;
6a445f4
         _cleanup_free_ gchar *tmp = NULL;
6a445f4
-        tmp_repodata_dir = g_build_filename(repo_dir, ".repodata.", NULL);
6a445f4
-        tmp = cr_append_pid_and_datetime(tmp_repodata_dir, "/");
6a445f4
-        tmp_repodata_dir = tmp;
6a445f4
+
6a445f4
+        tmp = g_build_filename(repo_dir, ".repodata.", NULL);
6a445f4
+        tmp_repodata_dir = cr_append_pid_and_datetime(tmp, "/");
6a445f4
 
6a445f4
         if (g_mkdir(tmp_repodata_dir, S_IRWXU | S_IRWXG | S_IROTH | S_IXOTH)) {
6a445f4
             g_critical("(--ignore-lock enabled) Cannot create %s: %s",
6a445f4
-- 
6a445f4
2.9.3
6a445f4