projects
/
project
/
ubus.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
ubusd_proto: fix crash when trying to subscribe to system objects
[project/ubus.git]
/
libubus.c
diff --git
a/libubus.c
b/libubus.c
index bfbaeb6565905f2614e202fc8c25d265fd1ca52c..8163ff7004fb6e23487a7661f9c55b8cc9a55783 100644
(file)
--- a/
libubus.c
+++ b/
libubus.c
@@
-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);
avl_init(&ctx->objects, ubus_cmp_id, false, NULL);
if (ubus_reconnect(ctx, path)) {
free(ctx->msgbuf.data);
+ ctx->msgbuf.data = NULL;
return -1;
}
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);
void ubus_shutdown(struct ubus_context *ctx)
{
blob_buf_free(&b);
+ if (!ctx)
+ return;
close(ctx->sock.fd);
free(ctx->msgbuf.data);
}
close(ctx->sock.fd);
free(ctx->msgbuf.data);
}