Fix a memory corruption issue related to ubus_free
In libubus, there is global variable defined as below. ubus_free() calls ubus_shutdown() which frees b->buf. which can cause memory corrupt when there is more than thread calls ubus_free() at the same time. In order to avoid this, ubus_free() shall be called only once when the program is about to exit. In other cases, ubus_free_context() shall be called to only free context specific resources but keep global buffer b->buf untouched.