X-Git-Url: http://git.openwrt.org/?a=blobdiff_plain;f=libubus.c;h=b25d8b084f9b6271bfd1625c24549c25edfb2a78;hb=df088f03c02aebba304a371486f09e95ed34bf5f;hp=bfbaeb6565905f2614e202fc8c25d265fd1ca52c;hpb=44a62711e0136a4a34f37d0b779c9c831818f9a4;p=project%2Fubus.git diff --git a/libubus.c b/libubus.c index bfbaeb6..b25d8b0 100644 --- a/libubus.c +++ b/libubus.c @@ -103,7 +103,7 @@ ubus_process_msg(struct ubus_context *ctx, struct ubus_msghdr_buf *buf, int fd) break; } - ubus_process_obj_msg(ctx, buf); + ubus_process_obj_msg(ctx, buf, fd); break; case UBUS_MSG_MONITOR: if (ctx->monitor_cb) @@ -294,6 +294,7 @@ int ubus_connect_ctx(struct ubus_context *ctx, const char *path) avl_init(&ctx->objects, ubus_cmp_id, false, NULL); if (ubus_reconnect(ctx, path)) { free(ctx->msgbuf.data); + ctx->msgbuf.data = NULL; return -1; } @@ -358,6 +359,8 @@ struct ubus_context *ubus_connect(const char *path) void ubus_shutdown(struct ubus_context *ctx) { blob_buf_free(&b); + if (!ctx) + return; close(ctx->sock.fd); free(ctx->msgbuf.data); }