From: Hans Dedecker Date: Mon, 1 Feb 2016 09:56:15 +0000 (+0100) Subject: device: Fix possible segfault X-Git-Url: http://git.cdn.openwrt.org/?a=commitdiff_plain;h=94c120a34f4d77ccaa9dbe42d4d74624593b6785;p=project%2Fnetifd.git device: Fix possible segfault Signed-off-by: Hans Dedecker --- diff --git a/device.c b/device.c index 6dc4fa9..65183f3 100644 --- a/device.c +++ b/device.c @@ -429,6 +429,9 @@ device_create_default(const char *name, bool external) D(DEVICE, "Create simple device '%s'\n", name); dev = calloc(1, sizeof(*dev)); + if (!dev) + return NULL; + dev->external = external; dev->set_state = simple_device_set_state; device_init(dev, &simple_device_type, name);