richardphibel / rpms / systemd

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