summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorHans Dedecker <dedeckeh@gmail.com>2016-02-01 10:56:22 +0100
committerFelix Fietkau <nbd@openwrt.org>2016-02-01 11:09:57 +0100
commitb998775b925330725e547af8d33394db0d638f7a (patch)
treec3f4fd70c90a2e41f1e9d8ef31f2fde806b75437
parent2d38e935ec6d5ad0cd3890fde6c2538f035186eb (diff)
interface: Fix possbile segfault
Signed-off-by: Hans Dedecker <dedeckeh@gmail.com>
-rw-r--r--interface.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/interface.c b/interface.c
index 2aab37c..7b18cef 100644
--- a/interface.c
+++ b/interface.c
@@ -189,6 +189,9 @@ interface_add_data(struct interface *iface, const struct blob_attr *data)
}
n = calloc(1, sizeof(*n) + len);
+ if (!n)
+ return UBUS_STATUS_UNKNOWN_ERROR;
+
memcpy(n->data, data, len);
n->node.key = blobmsg_name(n->data);
avl_insert(&iface->data, &n->node);