cr_lock_repo: Fix segfault caused by freed tmp_repodata_dir variable
authorTomas Mlcoch <tmlcoch@redhat.com>
Fri, 19 Aug 2016 12:59:26 +0000 (14:59 +0200)
committerTomas Mlcoch <tmlcoch@redhat.com>
Fri, 19 Aug 2016 12:59:26 +0000 (14:59 +0200)
src/createrepo_shared.c

index 5872029b027f7ec4c783782c5be6021bd301f3de..d4df86cbd40a713e0f4c5d9ce09d29e79a227670 100644 (file)
@@ -258,12 +258,11 @@ cr_lock_repo(const gchar *repo_dir,
             g_debug("(--ignore-lock enabled) For data generation is used: %s",
                     tmp_repodata_dir);
         }
-    }
 
-    if (tmp_repodata_dir)
         *tmp_repodata_dir_p = g_strdup(tmp_repodata_dir);
-    else
+    } else {
         *tmp_repodata_dir_p = g_strdup(lock_dir);
+    }
 
     return TRUE;
 }