[OpenWrt-Devel] [PATCH netifd 05/16] tunnel: Fix possible segfault

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


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

diff --git a/tunnel.c b/tunnel.c
index 524fd43..4a6c409 100644
--- a/tunnel.c
+++ b/tunnel.c
@@ -67,6 +67,9 @@ tunnel_create(const char *name, struct blob_attr *attr)
 	struct device *dev;
 
 	tun = calloc(1, sizeof(*tun));
+	if (!tun)
+		return NULL;
+
 	dev = &tun->dev;
 	device_init(dev, &tunnel_device_type, name);
 	tun->set_state = dev->set_state;
-- 
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