[OpenWrt-Devel] [PATCH netifd 01/16] device: Fix possible segfault

Hans Dedecker dedeckeh at gmail.com
Mon Feb 1 04:56:15 EST 2016


Signed-off-by: Hans Dedecker <dedeckeh at gmail.com>
---
 device.c | 3 +++
 1 file changed, 3 insertions(+)

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);
-- 
1.9.1
_______________________________________________
openwrt-devel mailing list
openwrt-devel at lists.openwrt.org
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel



More information about the openwrt-devel mailing list