Objects are stored in the ubus context in an AVL tree. An AVL tree
node contains a pointer to a key value. For the ubus context, this
points to the id member of the object structure. In
ubus_remove_object_cb, the id member is set to zero and then after,
avl_delete is called and fails. To fix this, we call avl_delete
before setting the object id to zero.
Signed-off-by: Bob Ham <bob.ham@tomltd.co.uk>
if (!attrbuf[UBUS_ATTR_OBJID])
return;
+ avl_delete(&req->ctx->objects, &obj->avl);
+
obj->id = 0;
if (attrbuf[UBUS_ATTR_OBJTYPE] && obj->type)
obj->type->id = 0;
-
- avl_delete(&req->ctx->objects, &obj->avl);
}
int ubus_remove_object(struct ubus_context *ctx, struct ubus_object *obj)