libubus: nullify stale msgbuf pointer in case of ubus_connect_ctx() failure
authorEyal Birger <eyal.birger@gmail.com>
Sun, 15 May 2016 05:13:27 +0000 (08:13 +0300)
committerFelix Fietkau <nbd@nbd.name>
Sun, 15 May 2016 07:39:24 +0000 (09:39 +0200)
commit3b8d4b5653ef47bd2032d377cecfee40b613eb72
tree2a73bf8570eb9959b1112364c2774af22dba1832
parentfcf5d8af65f41d6a106ad08d1df5de9729f5399a
libubus: nullify stale msgbuf pointer in case of ubus_connect_ctx() failure

If the ubus_reconnect() call fails in ubus_connect_ctx(), the msgbuf.data
newly allocated buffer is freed, but its pointer in the ubus_context is not
removed.

This leads to a double free error if ubus_auto_shutdown() is called for cleanup
after ubus_auto_connect() failed to connect to ubusd.

Signed-off-by: Eyal Birger <eyal.birger@gmail.com>
libubus.c