5509c00
From 09220715e259bf23cbe33d497ed92259a9670320 Mon Sep 17 00:00:00 2001
5509c00
From: Andreas Henriksson <andreas@fatal.se>
5509c00
Date: Fri, 13 Jun 2014 18:48:18 +0200
5509c00
Subject: [PATCH] install: fix invalid free() in unit_file_mask()
5509c00
5509c00
int unit_file_mask(...) in ./src/shared/install.c calls
5509c00
get_config_path(...) which can in 4 error cases return without setting
5509c00
"ret", and thus "prefix" can be uninitialized when unit_file_mask(...)
5509c00
finishes (which it does directly after the error is returned from
5509c00
get_config_path(...)).
5509c00
5509c00
(cherry picked from commit 223217749e57996336d5730b0a28716cca56d45d)
5509c00
---
5509c00
 src/shared/install.c | 2 +-
5509c00
 1 file changed, 1 insertion(+), 1 deletion(-)
5509c00
5509c00
diff --git a/src/shared/install.c b/src/shared/install.c
5509c00
index 487d0f66..f5620633 100644
5509c00
--- a/src/shared/install.c
5509c00
+++ b/src/shared/install.c
5509c00
@@ -563,7 +563,7 @@ int unit_file_mask(
5509c00
                 unsigned *n_changes) {
5509c00
 
5509c00
         char **i;
5509c00
-        _cleanup_free_ char *prefix;
5509c00
+        _cleanup_free_ char *prefix = NULL;
5509c00
         int r;
5509c00
 
5509c00
         assert(scope >= 0);