From 37322726573f931610744214fc2835f3cc4c76ca Mon Sep 17 00:00:00 2001
From: Jakob Olsson <jakob.olsson@iopsys.eu>
Date: Wed, 31 Mar 2021 16:32:14 +0200
Subject: [PATCH] map-agent: error handling on channel scan

---
 src/core/agent.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/src/core/agent.c b/src/core/agent.c
index b79638c8d..138f2b8cc 100644
--- a/src/core/agent.c
+++ b/src/core/agent.c
@@ -3115,7 +3115,7 @@ void parse_scanresults(struct ubus_request *req, int type, struct blob_attr *msg
 		// if no neighbors, allocated
 		if (scanres_el->num_neighbors == 0) {
 			scanres_el->nbrlist = calloc(1, 1 * sizeof(*(scanres_el->nbrlist)));
-			if (!scanres_el)
+			if (!scanres_el->nbrlist)
 				continue;
 			scanres_el->num_neighbors++;
 		}
@@ -3127,7 +3127,8 @@ void parse_scanresults(struct ubus_request *req, int type, struct blob_attr *msg
 			if (nbr) {
 				scanres_el->num_neighbors++;
 				scanres_el->nbrlist = nbr;
-			}
+			} else
+				continue;
 		}
 		f = scanres_el->num_neighbors - 1; // fill index
 		// Fill in the neoghbour data
-- 
GitLab