Browse Source

ubus: fix uhttpd crash

Unregister ubus subscriber in notification remove callback.
Without this call, uhttpd crashes when client tries to subscribe to
the ubus object after the object was unregistred and registered again.
It is bacuse the reference to ubus subscriber is not freed but
the memory is cleared in the uh_request_done function.

Signed-off-by: Wojciech Jowsa <wojciech.jowsa@gmail.com>
Wojciech Jowsa 3 years ago
parent
commit
f53a639997
1 changed files with 2 additions and 0 deletions
  1. 2 0
      ubus.c

+ 2 - 0
ubus.c

@@ -357,6 +357,8 @@ static void uh_ubus_subscription_notification_remove_cb(struct ubus_context *ctx
 	du = container_of(s, struct dispatch_ubus, sub);
 	cl = container_of(du, struct client, dispatch.ubus);
 
+	ubus_unregister_subscriber(ctx, &du->sub);
+
 	ops->request_done(cl);
 }