mirror of
https://dev.iopsys.eu/bbf/bbfdm.git
synced 2025-12-10 07:44:39 +01:00
libbbfdm-ubus: free 'bbfdm_ctx' dynamic allocations only when 'ubus_ctx' is initialized
This commit is contained in:
parent
1a86b8a443
commit
4855d91797
1 changed files with 3 additions and 4 deletions
|
|
@ -1060,19 +1060,18 @@ int bbfdm_ubus_register_init(struct bbfdm_context *bbfdm_ctx)
|
||||||
|
|
||||||
int bbfdm_ubus_register_free(struct bbfdm_context *bbfdm_ctx)
|
int bbfdm_ubus_register_free(struct bbfdm_context *bbfdm_ctx)
|
||||||
{
|
{
|
||||||
free_apply_handlers(&bbfdm_ctx->config);
|
|
||||||
free_changed_uci(bbfdm_ctx);
|
|
||||||
|
|
||||||
if (bbfdm_ctx->ubus_ctx) {
|
if (bbfdm_ctx->ubus_ctx) {
|
||||||
ubus_unregister_event_handler(bbfdm_ctx->ubus_ctx, &bbfdm_ctx->apply_event);
|
ubus_unregister_event_handler(bbfdm_ctx->ubus_ctx, &bbfdm_ctx->apply_event);
|
||||||
free_ubus_event_handler(bbfdm_ctx->ubus_ctx, &bbfdm_ctx->event_handlers);
|
free_ubus_event_handler(bbfdm_ctx->ubus_ctx, &bbfdm_ctx->event_handlers);
|
||||||
|
free_apply_handlers(&bbfdm_ctx->config);
|
||||||
|
free_changed_uci(bbfdm_ctx);
|
||||||
|
bbfdm_ctx_cleanup(bbfdm_ctx);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (bbfdm_ctx->ubus_ctx && bbfdm_ctx->internal_ubus_ctx) {
|
if (bbfdm_ctx->ubus_ctx && bbfdm_ctx->internal_ubus_ctx) {
|
||||||
ubus_free(bbfdm_ctx->ubus_ctx);
|
ubus_free(bbfdm_ctx->ubus_ctx);
|
||||||
uloop_done();
|
uloop_done();
|
||||||
}
|
}
|
||||||
bbfdm_ctx_cleanup(bbfdm_ctx);
|
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue