]> git.ipfire.org Git - thirdparty/cups.git/commitdiff
Fix an Avahi-related crash bug in the scheduler (Issue #5085, Issue #5086)
authorMichael Sweet <michael.r.sweet@gmail.com>
Mon, 28 Aug 2017 14:04:29 +0000 (10:04 -0400)
committerMichael Sweet <michael.r.sweet@gmail.com>
Mon, 28 Aug 2017 14:04:29 +0000 (10:04 -0400)
Add NULL pointer check to avoid Avahi assertion in production code.

CHANGES.md
scheduler/dirsvc.c

index 5ac9ec1072e1e590f233ac8bbbda5012a24ef489..2dbd33ff18c1cbc5fca5a9de4e0b181bf9e2af16 100644 (file)
@@ -26,6 +26,7 @@ CHANGES IN CUPS V2.2.5
   values (Issue #5074)
 - The scheduler now creates a PID file when not running on demand with a modern
   service launcher (Issue #5080)
+- Fixed an Avahi-related crash bug in the scheduler (Issue #5085, Issue #5086)
 - The IPP Everywhere PPD generator now sorts the supported resolutions before
   choosing them for draft, normal, and best quality modes (Issue #5091)
 - Fixed an issue with Chinese localizations on macOS (rdar://32419311)
index 6f6aa8bb446dc38f1ccbd416e39b2ad3771fdfd3..2308e05384bc90552a505590914ce876789b0c6c 100644 (file)
@@ -699,13 +699,16 @@ dnssdDeregisterInstance(
   DNSServiceRefDeallocate(*srv);
 
 #  else /* HAVE_AVAHI */
-  if (!from_callback)
-    avahi_threaded_poll_lock(DNSSDMaster);
+  if (*srv)
+  {
+    if (!from_callback)
+      avahi_threaded_poll_lock(DNSSDMaster);
 
-  avahi_entry_group_free(*srv);
+    avahi_entry_group_free(*srv);
 
-  if (!from_callback)
-    avahi_threaded_poll_unlock(DNSSDMaster);
+    if (!from_callback)
+      avahi_threaded_poll_unlock(DNSSDMaster);
+  }
 #  endif /* HAVE_DNSSD */
 
   *srv = NULL;