teknoraver / rpms / systemd

Forked from rpms/systemd 2 months ago
Clone

Blame SOURCES/0566-cryptsetup-generator-use-after-free.patch

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