From d486006ab93f128392417b06a9e0226e571fc302 Mon Sep 17 00:00:00 2001 From: Lukasz Baj Date: Thu, 29 Aug 2013 11:05:51 +0200 Subject: [PATCH] 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 --- libubus-obj.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) 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 -- 2.11.0