[gvfs] dnssd: guard avahi_client_free to prevent freeing NULL



commit a36f8846731f07ec7ff38cfa3ff1a233ea929481
Author: Tobias Mueller <muelli cryptobitch de>
Date:   Wed Nov 27 21:06:42 2019 +0100

    dnssd: guard avahi_client_free to prevent freeing NULL
    
    This should not happen, but somehow the global_client ends up
    being NULL.
    In daemon/gvfsbackenddnssd.c the call to avahi_client_free in
    the finalize function is similarly guarded.

 common/gvfsdnssdresolver.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)
---
diff --git a/common/gvfsdnssdresolver.c b/common/gvfsdnssdresolver.c
index 7db7ef5f..7aa2cfcb 100644
--- a/common/gvfsdnssdresolver.c
+++ b/common/gvfsdnssdresolver.c
@@ -176,7 +176,10 @@ free_global_avahi_client (void)
   g_list_foreach (resolvers, (GFunc) remove_client_from_resolver, NULL);
 
   /* Destroy client */
-  avahi_client_free (global_client);
+  if (global_client)
+    {
+      avahi_client_free (global_client);
+    }
   global_client = NULL;
   avahi_initialized = FALSE;
 }


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]