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

diff --git a/ubus.c b/ubus.c
index 454b42d..4184301 100644 (file)
--- a/ubus.c
+++ b/ubus.c
@@ -969,6 +969,9 @@ static void netifd_add_iface_object(void)
        int i;
 
        methods = calloc(1, sizeof(iface_object_methods));
+       if (!methods)
+               return;
+
        memcpy(methods, iface_object_methods, sizeof(iface_object_methods));
        iface_object.methods = methods;