From: Lukasz Baj Date: Thu, 29 Aug 2013 09:05:51 +0000 (+0200) Subject: libubus: Check if remove callback exists before call it X-Git-Url: http://git.archive.openwrt.org/?p=project%2Fubus.git;a=commitdiff_plain;h=d486006ab93f128392417b06a9e0226e571fc302;hp=b20a8a01c7faea5bcc9d34d10dcf7736589021b8;ds=sidebyside libubus: Check if remove callback exists before call it When process unsubscribes then remove callback is called. But it can be NULL if not defined, so we should check it before we call it. Signed-off-by: Lukasz Baj --- diff --git a/libubus-obj.c b/libubus-obj.c index ed18ca9..bdb2e03 100644 --- a/libubus-obj.c +++ b/libubus-obj.c @@ -27,7 +27,8 @@ ubus_process_unsubscribe(struct ubus_context *ctx, struct ubus_msghdr *hdr, return; s = container_of(obj, struct ubus_subscriber, obj); - s->remove_cb(ctx, s, blob_get_u32(attrbuf[UBUS_ATTR_TARGET])); + if (s->remove_cb) + s->remove_cb(ctx, s, blob_get_u32(attrbuf[UBUS_ATTR_TARGET])); } static void