X-Git-Url: http://git.openwrt.org/?a=blobdiff_plain;f=plugin.c;h=70d2c563ba3f12329b138481be12f825efd2f2ea;hb=0577cfc1acdbaf30c31090e75045ba58d6dd8a78;hp=687944d672d8cd6c383ba11fe4c09b781cb03f21;hpb=0c4e97b4e7b440d02aec3aff9d06c9bc93717571;p=project%2Frpcd.git diff --git a/plugin.c b/plugin.c index 687944d..70d2c56 100644 --- a/plugin.c +++ b/plugin.c @@ -108,12 +108,9 @@ rpc_plugin_call_finish_cb(struct blob_buf *blob, int stat, void *priv) { if (c->obj) { - if (json_object_get_type(c->obj) == json_type_object || - json_object_get_type(c->obj) == json_type_array) - { - blobmsg_add_json_element(blob, NULL, c->obj); + if (json_object_get_type(c->obj) == json_type_object && + blobmsg_add_object(blob, c->obj)) rv = UBUS_STATUS_OK; - } json_object_put(c->obj); } @@ -327,7 +324,9 @@ rpc_plugin_parse_exec(const char *name, int fd) if (!obj_type) return NULL; - asprintf((char **)&obj_type->name, "luci-rpc-plugin-%s", name); + if (asprintf((char **)&obj_type->name, "luci-rpc-plugin-%s", name) < 0) + return NULL; + obj_type->methods = methods; obj_type->n_methods = n_method;