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 <l.baj@radytek.com>
This commit is contained in:
Lukasz Baj 2013-08-29 11:05:51 +02:00 committed by Felix Fietkau
parent b20a8a01c7
commit d486006ab9

View file

@ -27,7 +27,8 @@ ubus_process_unsubscribe(struct ubus_context *ctx, struct ubus_msghdr *hdr,
return; return;
s = container_of(obj, struct ubus_subscriber, obj); 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 static void