summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorHans Dedecker <dedeckeh@gmail.com>2019-06-13 21:59:31 +0200
committerHans Dedecker <dedeckeh@gmail.com>2019-06-13 22:01:26 +0200
commit42a38785f1d229483c68ac22e1707be57e8fe60e (patch)
treea1adb7d22eb846a0ad33e2423a188a3983bc71cd
parentc1964d8eaf612d997e81474eb75071bedb2b914a (diff)
interface-ip: fix possible null pointer dereference
Reported by Coverity in CID 1445749 Signed-off-by: Hans Dedecker <dedeckeh@gmail.com>
-rw-r--r--interface-ip.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/interface-ip.c b/interface-ip.c
index 864de50..c159e09 100644
--- a/interface-ip.c
+++ b/interface-ip.c
@@ -353,11 +353,11 @@ interface_ip_add_neighbor(struct interface *iface, struct blob_attr *attr, bool
ip = &iface->proto_ip;
neighbor = calloc(1,sizeof(*neighbor));
- neighbor->flags = v6 ? DEVADDR_INET6 : DEVADDR_INET4;
-
if (!neighbor)
return;
+ neighbor->flags = v6 ? DEVADDR_INET6 : DEVADDR_INET4;
+
if ((cur = tb[NEIGHBOR_ADDRESS]) != NULL){
if (!inet_pton(af, blobmsg_data(cur), &neighbor->addr))
goto error;