[systemd-devel] [PATCH 4/4] udev: fix invalid free() in enable_name_policy()

Andreas Henriksson andreas at fatal.se
Fri Jun 13 09:48:21 PDT 2014


static bool enable_name_policy(...) in ./src/udev/net/link-config.c
calls proc_cmdline(...) to get "line" initialized, but
proc_cmdline(...) does not guarantee that atleast when both
conditions (detect_container(NULL) > 0) and
read_full_file(...) returned < 0.

Signed-off-by: Andreas Henriksson <andreas at fatal.se>
---
 src/udev/net/link-config.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/udev/net/link-config.c b/src/udev/net/link-config.c
index a9acc3d..7a9d01b 100644
--- a/src/udev/net/link-config.c
+++ b/src/udev/net/link-config.c
@@ -185,7 +185,7 @@ static int load_link(link_config_ctx *ctx, const char *filename) {
 }
 
 static bool enable_name_policy(void) {
-        _cleanup_free_ char *line;
+        _cleanup_free_ char *line = NULL;
         char *w, *state;
         int r;
         size_t l;
-- 
2.0.0



More information about the systemd-devel mailing list