923a60
From ae554d506040559c2dbf972ecf4a33be4fb6d869 Mon Sep 17 00:00:00 2001
923a60
From: Lukas Nykryn <lnykryn@redhat.com>
923a60
Date: Tue, 31 Oct 2017 12:59:02 +0100
923a60
Subject: [PATCH] cryptsetup-generator: use after free
923a60
923a60
rhel-only
923a60
923a60
Related: #1477757
923a60
---
923a60
 src/cryptsetup/cryptsetup-generator.c | 4 +---
923a60
 1 file changed, 1 insertion(+), 3 deletions(-)
923a60
923a60
diff --git a/src/cryptsetup/cryptsetup-generator.c b/src/cryptsetup/cryptsetup-generator.c
923a60
index 82a280d865..c387e2104c 100644
923a60
--- a/src/cryptsetup/cryptsetup-generator.c
923a60
+++ b/src/cryptsetup/cryptsetup-generator.c
923a60
@@ -214,10 +214,8 @@ static int create_disk(
923a60
                         return log_oom();
923a60
 
923a60
                 mkdir_parents_label(to, 0755);
923a60
-                if (symlink(from, to) < 0) {
923a60
-                        free(to);
923a60
+                if (symlink(from, to) < 0)
923a60
                         return log_error_errno(errno, "Failed to create symlink %s: %m", to);
923a60
-                }
923a60
         }
923a60
 
923a60
         free(to);