implement Lua binding
[project/ubus.git] / ubusd_proto.c
index 902eb0f24b08a808e6a0f5e9889fecdb07813b14..d49ef48e61adb9dbb149e30913b4ade2c20b8395 100644 (file)
@@ -163,7 +163,6 @@ static int ubusd_handle_lookup(struct ubus_client *cl, struct ubus_msg_buf *ub,
 {
        struct ubus_object *obj;
        char *objpath;
-       bool wildcard = false;
        bool found = false;
        int len;
 
@@ -185,7 +184,6 @@ static int ubusd_handle_lookup(struct ubus_client *cl, struct ubus_msg_buf *ub,
        }
 
        objpath[--len] = 0;
-       wildcard = true;
 
        obj = avl_find_ge_element(&path, objpath, obj, path);
        if (!obj)
@@ -207,6 +205,7 @@ static int ubusd_handle_lookup(struct ubus_client *cl, struct ubus_msg_buf *ub,
 
 static int ubusd_handle_invoke(struct ubus_client *cl, struct ubus_msg_buf *ub, struct blob_attr **attr)
 {
+       struct ubus_msg_buf *ub_new;
        struct ubus_object *obj = NULL;
        struct ubus_id *id;
        const char *method;
@@ -232,9 +231,10 @@ static int ubusd_handle_invoke(struct ubus_client *cl, struct ubus_msg_buf *ub,
                blob_put(&b, UBUS_ATTR_DATA, blob_data(attr[UBUS_ATTR_DATA]),
                         blob_len(attr[UBUS_ATTR_DATA]));
 
+       ub_new = ubus_reply_from_blob(ub, true);
        ubus_msg_free(ub);
+       ub = ub_new;
 
-       ub = ubus_reply_from_blob(ub, true);
        if (!ub)
                return UBUS_STATUS_NO_DATA;