When destroying the UBus context, private fields of our ubus_object were
being reset to 0 while UBus was still owning those objects. While this
seems to work out fine, it seems cleaner to first release the object so
that UBus no longer owns it, before proceding to reset those fields.

Signed-off-by: Etan Kissling <etan.kissl...@gmail.com>
---
 src/ubus.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/src/ubus.c b/src/ubus.c
index 37e36fa..d8cbeca 100644
--- a/src/ubus.c
+++ b/src/ubus.c
@@ -81,12 +81,12 @@ static void ubus_subscribe_cb(struct ubus_context *ctx, 
struct ubus_object *obj)
 
 static void ubus_destroy(struct ubus_context *ubus)
 {
+  ubus_free(ubus);
+  daemon->ubus = NULL;
+  
   // Forces re-initialization when we're reusing the same definitions later on.
   ubus_object.id = 0;
   ubus_object_type.id = 0;
-
-  ubus_free(ubus);
-  daemon->ubus = NULL;
 }
 
 static void ubus_disconnect_cb(struct ubus_context *ubus)
-- 
2.30.1 (Apple Git-130)


_______________________________________________
Dnsmasq-discuss mailing list
Dnsmasq-discuss@lists.thekelleys.org.uk
https://lists.thekelleys.org.uk/cgi-bin/mailman/listinfo/dnsmasq-discuss

Reply via email to