]> git.ipfire.org Git - thirdparty/cups.git/commitdiff
Fix crashes on Linux (Issue #5022)
authorMichael R Sweet <michael.r.sweet@gmail.com>
Sat, 17 Jun 2017 03:15:47 +0000 (23:15 -0400)
committerMichael R Sweet <michael.r.sweet@gmail.com>
Sat, 17 Jun 2017 03:15:47 +0000 (23:15 -0400)
Makedefs.in
cups/dest.c

index 2edb13f46fc222f486fec6b66b1a06fcce758539..f958c263f32865af226a696b362aa836112a0d5a 100644 (file)
@@ -149,7 +149,7 @@ IPPFIND_MAN =       @IPPFIND_MAN@
 LDFLAGS                =       -L../cgi-bin -L../cups -L../filter -L../ppdc \
                        -L../scheduler @LDARCHFLAGS@ \
                        @LDFLAGS@ @RELROFLAGS@ @PIEFLAGS@ $(OPTIM)
-LINKCUPS       =       @LINKCUPS@ $(LIBGSSAPI) $(DNSSDLIBS) $(LIBZ)
+LINKCUPS       =       @LINKCUPS@ $(LIBGSSAPI) $(DNSSDLIBS) $(SSLLIBS) $(LIBZ)
 LINKCUPSIMAGE  =       @LINKCUPSIMAGE@
 LIBS           =       $(LINKCUPS) $(COMMONLIBS)
 ONDEMANDFLAGS  =       @ONDEMANDFLAGS@
index f5b0fb402812c1a182aa82f2269d9fae1c1f1c2b..1b62643f9c4ec3bc8d0cf8f0de527246b9a76680 100644 (file)
@@ -1324,28 +1324,37 @@ cupsEnumDests(
   enum_finished:
 
 #if defined(HAVE_DNSSD) || defined(HAVE_AVAHI)
+  cupsArrayDelete(data.devices);
+
 #  ifdef HAVE_DNSSD
-  DNSServiceRefDeallocate(ipp_ref);
-  DNSServiceRefDeallocate(local_ipp_ref);
+  if (ipp_ref)
+    DNSServiceRefDeallocate(ipp_ref);
+  if (local_ipp_ref)
+    DNSServiceRefDeallocate(local_ipp_ref);
 
 #    ifdef HAVE_SSL
-  DNSServiceRefDeallocate(ipp_ref);
-  DNSServiceRefDeallocate(local_ipp_ref);
+  if (ipps_ref)
+    DNSServiceRefDeallocate(ipps_ref);
+  if (local_ipps_ref)
+    DNSServiceRefDeallocate(local_ipps_ref);
 #    endif /* HAVE_SSL */
 
-  DNSServiceRefDeallocate(data.main_ref);
+  if (data.main_ref)
+    DNSServiceRefDeallocate(data.main_ref);
 
 #  else /* HAVE_AVAHI */
-  avahi_service_browser_free(ipp_ref);
+  if (ipp_ref)
+    avahi_service_browser_free(ipp_ref);
 #    ifdef HAVE_SSL
-  avahi_service_browser_free(ipps_ref);
+  if (ipps_ref)
+    avahi_service_browser_free(ipps_ref);
 #    endif /* HAVE_SSL */
 
-  avahi_client_free(data.client);
-  avahi_simple_poll_free(data.simple_poll);
+  if (data.client)
+    avahi_client_free(data.client);
+  if (data.simple_poll)
+    avahi_simple_poll_free(data.simple_poll);
 #  endif /* HAVE_DNSSD */
-
-  cupsArrayDelete(data.devices);
 #endif /* HAVE_DNSSD || HAVE_AVAHI */
 
   return (1);