chiark / gitweb /
udev: fix invalid free() in enable_name_policy()
authorAndreas Henriksson <andreas@fatal.se>
Fri, 13 Jun 2014 16:48:21 +0000 (18:48 +0200)
committerTom Gundersen <teg@jklm.no>
Fri, 13 Jun 2014 17:00:42 +0000 (19:00 +0200)
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.

src/udev/net/link-config.c

index a9acc3ddb7f3173058a07209f4680abb16abba54..7a9d01bc184df118d0cf76fa9eb66395406d1f58 100644 (file)
@@ -185,7 +185,7 @@ static int load_link(link_config_ctx *ctx, const char *filename) {
 }
 
 static bool enable_name_policy(void) {
 }
 
 static bool enable_name_policy(void) {
-        _cleanup_free_ char *line;
+        _cleanup_free_ char *line = NULL;
         char *w, *state;
         int r;
         size_t l;
         char *w, *state;
         int r;
         size_t l;