[LEDE-DEV] [PATCH] procd: Fix minor null pointer dereference.

Rosen Penev rosenp at gmail.com
Mon Dec 25 14:52:20 PST 2017


Null pointer check was placed after assigning values to c.

Signed-off-by: Rosen Penev <rosenp at gmail.com>
---
 plug/hotplug.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/plug/hotplug.c b/plug/hotplug.c
index c52259e..80e6e4d 100644
--- a/plug/hotplug.c
+++ b/plug/hotplug.c
@@ -392,12 +392,12 @@ static void queue_add(struct cmd_handler *h, struct blob_attr *msg, struct blob_
 		&_data, blob_pad_len(data),
 		NULL);
 
-	c->msg = _msg;
-	c->data = _data;
-
 	if (!c)
 		return;
 
+	c->msg = _msg;
+	c->data = _data;
+
 	memcpy(c->msg, msg, blob_pad_len(msg));
 	memcpy(c->data, data, blob_pad_len(data));
 	c->handler = h->handler;
-- 
2.7.4




More information about the Lede-dev mailing list