X-Git-Url: http://git.archive.openwrt.org/?p=project%2Fubus.git;a=blobdiff_plain;f=libubus.c;h=e42f14f9cdf026a3dea36beeb45d60557cb717b9;hp=83a2c43540c828f5e36c7e868f4b1799c627a72b;hb=73cbb94b4808ac86e686ef80ff4af9b4b84945bd;hpb=7e746e5a850b1c5ef87b8d8538e921f2051f5471 diff --git a/libubus.c b/libubus.c index 83a2c43..e42f14f 100644 --- a/libubus.c +++ b/libubus.c @@ -243,8 +243,11 @@ int ubus_register_event_handler(struct ubus_context *ctx, if (pattern) blobmsg_add_string(&b2, "pattern", pattern); - return ubus_invoke(ctx, UBUS_SYSTEM_OBJECT_EVENT, "register", b2.head, + ret = ubus_invoke(ctx, UBUS_SYSTEM_OBJECT_EVENT, "register", b2.head, NULL, NULL, 0); + blob_buf_free(&b2); + + return ret; } int ubus_send_event(struct ubus_context *ctx, const char *id, @@ -280,9 +283,10 @@ static int _ubus_connect(struct ubus_context *ctx, const char *path) ctx->connection_lost = ubus_default_connection_lost; ctx->pending_timer.cb = ubus_process_pending_msg; - ctx->msgbuf.data = calloc(UBUS_MAX_MSGLEN, sizeof(char)); + ctx->msgbuf.data = calloc(UBUS_MSG_CHUNK_SIZE, sizeof(char)); if (!ctx->msgbuf.data) return -1; + ctx->msgbuf_data_len = UBUS_MSG_CHUNK_SIZE; INIT_LIST_HEAD(&ctx->requests); INIT_LIST_HEAD(&ctx->pending);