summaryrefslogtreecommitdiff
path: root/ubusd_proto.c
diff options
context:
space:
mode:
authorHans Dedecker <dedeckeh@gmail.com>2015-04-13 18:18:36 +0200
committerFelix Fietkau <nbd@openwrt.org>2015-04-20 15:43:19 +0200
commit7798d56301b7264cbcea0a6a9225a210154c693a (patch)
treebd7020f6aecccc6df6ea5ed50f8eec15578029db /ubusd_proto.c
parent2d660c519d2fcff95248da9f4fd9b37d61f9eb09 (diff)
downloadubus-7798d56301b7264cbcea0a6a9225a210154c693a.tar.gz
ubus: Fix issues reported by static code analysis tool Klocwork
Signed-off-by: Hans Dedecker <dedeckeh@gmail.com>
Diffstat (limited to 'ubusd_proto.c')
-rw-r--r--ubusd_proto.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/ubusd_proto.c b/ubusd_proto.c
index 6b068eb..991a70a 100644
--- a/ubusd_proto.c
+++ b/ubusd_proto.c
@@ -487,6 +487,9 @@ void ubus_notify_subscription(struct ubus_object *obj)
blob_put_int8(&b, UBUS_ATTR_ACTIVE, active);
ub = ubus_msg_from_blob(false);
+ if (!ub)
+ return;
+
ubus_msg_init(ub, UBUS_MSG_NOTIFY, ++obj->invoke_seq, 0);
ubus_msg_send(obj->client, ub, true);
}
@@ -500,8 +503,10 @@ void ubus_notify_unsubscribe(struct ubus_subscription *s)
blob_put_int32(&b, UBUS_ATTR_TARGET, s->target->id.id);
ub = ubus_msg_from_blob(false);
- ubus_msg_init(ub, UBUS_MSG_UNSUBSCRIBE, ++s->subscriber->invoke_seq, 0);
- ubus_msg_send(s->subscriber->client, ub, true);
+ if (ub != NULL) {
+ ubus_msg_init(ub, UBUS_MSG_UNSUBSCRIBE, ++s->subscriber->invoke_seq, 0);
+ ubus_msg_send(s->subscriber->client, ub, true);
+ }
ubus_unsubscribe(s);
}