Skip to content

Commit

Permalink
Fix an Avahi-related crash bug in the scheduler (Issue #5085, Issue #…
Browse files Browse the repository at this point in the history
…5086)

Add NULL pointer check to avoid Avahi assertion in production code.
  • Loading branch information
michaelrsweet committed Aug 28, 2017
1 parent e9b2d70 commit b337f96
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 5 deletions.
1 change: 1 addition & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
13 changes: 8 additions & 5 deletions scheduler/dirsvc.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit b337f96

Please sign in to comment.