alias: Fix possible segfault
authorHans Dedecker <dedeckeh@gmail.com>
Mon, 1 Feb 2016 09:56:28 +0000 (10:56 +0100)
committerFelix Fietkau <nbd@openwrt.org>
Mon, 1 Feb 2016 10:09:58 +0000 (11:09 +0100)
Signed-off-by: Hans Dedecker <dedeckeh@gmail.com>
alias.c

diff --git a/alias.c b/alias.c
index 01bec41f309f2c3cbef433491270455e83ee80c1..1f23da08ac5e66eab4f2b6569013f7fc0d098673 100644 (file)
--- a/alias.c
+++ b/alias.c
@@ -112,6 +112,9 @@ alias_device_create(const char *name, struct blob_attr *attr)
        struct alias_device *alias;
 
        alias = calloc(1, sizeof(*alias) + strlen(name) + 1);
+       if (!alias)
+               return NULL;
+
        strcpy(alias->name, name);
        alias->dev.set_state = alias_device_set_state;
        alias->dev.hidden = true;