procd: Fix minor null pointer dereference.
authorRosen Penev <rosenp@gmail.com>
Mon, 25 Dec 2017 22:52:20 +0000 (14:52 -0800)
committerHans Dedecker <dedeckeh@gmail.com>
Thu, 4 Jan 2018 10:16:15 +0000 (11:16 +0100)
Null pointer check was placed after assigning values to c.

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

index ffedba242bf450c96484abdea3c4cfc05c0eb0fe..0b801e77459acc6e86379b3490449d64ba7cb110 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;