chiark / gitweb /
install: fix invalid free() in unit_file_mask()
authorAndreas Henriksson <andreas@fatal.se>
Fri, 13 Jun 2014 16:48:18 +0000 (18:48 +0200)
committerTom Gundersen <teg@jklm.no>
Fri, 13 Jun 2014 17:01:07 +0000 (19:01 +0200)
int unit_file_mask(...) in ./src/shared/install.c calls
get_config_path(...) which can in 4 error cases return without setting
"ret", and thus "prefix" can be uninitialized when unit_file_mask(...)
finishes (which it does directly after the error is returned from
get_config_path(...)).

src/shared/install.c

index 487d0f660d40b6f13d3be1435e9d4a65a6dd187c..f5620633c08a824e92a872332924c6e21bbd30ad 100644 (file)
@@ -563,7 +563,7 @@ int unit_file_mask(
                 unsigned *n_changes) {
 
         char **i;
-        _cleanup_free_ char *prefix;
+        _cleanup_free_ char *prefix = NULL;
         int r;
 
         assert(scope >= 0);