dcavalca / rpms / systemd

Forked from rpms/systemd 3 months ago
Clone
84b277
From b1de3eb93bfdc4cf3872d9e1005166bb9867b0b2 Mon Sep 17 00:00:00 2001
84b277
From: Andreas Henriksson <andreas@fatal.se>
84b277
Date: Fri, 13 Jun 2014 18:48:18 +0200
84b277
Subject: [PATCH] install: fix invalid free() in unit_file_mask()
84b277
84b277
int unit_file_mask(...) in ./src/shared/install.c calls
84b277
get_config_path(...) which can in 4 error cases return without setting
84b277
"ret", and thus "prefix" can be uninitialized when unit_file_mask(...)
84b277
finishes (which it does directly after the error is returned from
84b277
get_config_path(...)).
84b277
84b277
(cherry-picked from 223217749e57996336d5730b0a28716cca56d45d)
84b277
84b277
Resolves: #1147524
84b277
---
84b277
 src/shared/install.c | 2 +-
84b277
 1 file changed, 1 insertion(+), 1 deletion(-)
84b277
84b277
diff --git a/src/shared/install.c b/src/shared/install.c
84b277
index dd5e22b..1662c5f 100644
84b277
--- a/src/shared/install.c
84b277
+++ b/src/shared/install.c
84b277
@@ -598,7 +598,7 @@ int unit_file_mask(
84b277
                 unsigned *n_changes) {
84b277
 
84b277
         char **i;
84b277
-        _cleanup_free_ char *prefix;
84b277
+        _cleanup_free_ char *prefix = NULL;
84b277
         int r;
84b277
 
84b277
         assert(scope >= 0);