procd: Fix minor null pointer dereference.
authorRosen Penev <rosenp@gmail.com>
Mon, 25 Dec 2017 22:52:20 +0000 (14:52 -0800)
committerJohn Crispin <john@phrozen.org>
Tue, 2 Jan 2018 06:22:50 +0000 (07:22 +0100)
Null pointer check was placed after assigning values to c.

Signed-off-by: Rosen Penev <rosenp@gmail.com>
plug/hotplug.c

index 9fc1938..0905e4e 100644 (file)
@@ -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;