if (!cur)
return true;
- d->params = cur;
+ d->params = blob_memdup(cur);
+ if (!d->params)
+ return false;
blobmsg_parse_array(data_policy, ARRAY_SIZE(data_policy), tb2,
- blobmsg_data(cur), blobmsg_data_len(cur));
+ blobmsg_data(d->params), blobmsg_data_len(d->params));
if (tb2[0])
d->object = blobmsg_data(tb2[0]);
}
uh_ubus_send_request(cl, obj, data.data);
- return;
+ goto out;
}
else if (!strcmp(data.method, "list")) {
uh_ubus_send_list(cl, obj, data.params);
- return;
+ goto out;
}
else {
err = ERROR_METHOD;
error:
uh_ubus_json_error(cl, err);
+out:
+ if (data.params)
+ free(data.params);
}
static void __uh_ubus_next_batched_request(struct uloop_timeout *timeout)