Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

avahi_client_free() called with NULL pointer during shutdown #4550

Closed
michaelrsweet opened this issue Dec 28, 2014 · 2 comments
Closed

avahi_client_free() called with NULL pointer during shutdown #4550

michaelrsweet opened this issue Dec 28, 2014 · 2 comments
Milestone

Comments

@michaelrsweet
Copy link
Collaborator

Version: 2.0.1
CUPS.org User: foutrelis

During system shutdown, CUPS logs the following error:

Unable to communicate with avahi-daemon: An unexpected D-Bus error occured

Shortly after that, cupsd calls avahi_client_free() with a NULL DNSSDClient pointer and immediately terminates with SIGABRT.

According to the systemd journal, "Avahi mDNS/DNS-SD Stack" is stopped before "CUPS Scheduler". My guess is that DNSSDClient is freed and set to NULL by dnssdClientCallback() following the termination of the Avahi daemon.

A simple solution would be to check if DNSSDClient is NULL before calling avahi_client_free() in dnssdStop(). Either a (DNSSDClient != NULL) or (avahi_running == 1) condition should suffice.

I'm using Arch Linux on x86_64 with the following software:

  • cups 2.0.1
  • systemd 218
  • avahi 0.6.31
@michaelrsweet
Copy link
Collaborator Author

CUPS.org User: mike

Fixed in Subversion repository.

@michaelrsweet
Copy link
Collaborator Author

"str4550.patch":

Index: scheduler/dirsvc.c

--- scheduler/dirsvc.c (revision 12451)
+++ scheduler/dirsvc.c (working copy)
@@ -3,7 +3,7 @@
*

  • Directory services routines for the CUPS scheduler.
    *

    • * Copyright 2007-2014 by Apple Inc.
    • * Copyright 2007-2015 by Apple Inc.
  • Copyright 1997-2007 by Easy Software Products, all rights reserved.
    *

  • These coded instructions, statements, and computer programs are the
    @@ -1296,13 +1296,20 @@
    DNSSDMaster = NULL;

    else /* HAVE_AVAHI */

    • avahi_threaded_poll_stop(DNSSDMaster);
    • if (DNSSDMaster)
    • avahi_threaded_poll_stop(DNSSDMaster);
  • avahi_client_free(DNSSDClient);

  • DNSSDClient = NULL;

  • if (DNSSDClient)

  • {

  • avahi_client_free(DNSSDClient);

  • DNSSDClient = NULL;

  • }

  • avahi_threaded_poll_free(DNSSDMaster);

  • DNSSDMaster = NULL;

  • if (DNSSDMaster)

  • {

  • avahi_threaded_poll_free(DNSSDMaster);

  • DNSSDMaster = NULL;

  • }

endif /* HAVE_DNSSD */

cupsArrayDelete(DNSSDPrinters);

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant