libubus: close file descriptor after passing it in the status msg
[project/ubus.git] / libubus-obj.c
index bdb2e03478d70541691448ff7e2b672e0711871e..a1062e0a5a8b247cb849b729867dd585c3d22761 100644 (file)
@@ -46,7 +46,9 @@ static void
 ubus_process_invoke(struct ubus_context *ctx, struct ubus_msghdr *hdr,
                    struct ubus_object *obj, struct blob_attr **attrbuf)
 {
-       struct ubus_request_data req = {};
+       struct ubus_request_data req = {
+               .fd = -1,
+       };
        int method;
        int ret;
        bool no_reply = false;
@@ -97,7 +99,7 @@ void __hidden ubus_process_obj_msg(struct ubus_context *ctx, struct ubus_msghdr
        struct ubus_object *obj;
        uint32_t objid;
 
-       attrbuf = ubus_parse_msg(hdr->data);
+       attrbuf = ubus_parse_msg(ubus_msghdr_data(hdr));
        if (!attrbuf[UBUS_ATTR_OBJID])
                return;