Blame SOURCES/0001-Fix-memory-leaks-found-by-Coverity-Issue-5375.patch

3635cf
diff --git a/backend/ipp.c b/backend/ipp.c
3635cf
index 32eb3aaa4..2a880bd75 100644
3635cf
--- a/backend/ipp.c
3635cf
+++ b/backend/ipp.c
3635cf
@@ -3612,6 +3612,8 @@ update_reasons(ipp_attribute_t *attr,	/* I - printer-state-reasons or NULL */
3635cf
     }
3635cf
   }
3635cf
 
3635cf
+  cupsArrayDelete(new_reasons);
3635cf
+
3635cf
   _cupsMutexUnlock(&report_mutex);
3635cf
 
3635cf
  /*
3635cf
diff --git a/cgi-bin/search.c b/cgi-bin/search.c
3635cf
index 3956afc33..ad1f5ed0e 100644
3635cf
--- a/cgi-bin/search.c
3635cf
+++ b/cgi-bin/search.c
3635cf
@@ -361,4 +362,5 @@ void
3635cf
 cgiFreeSearch(void *search)		/* I - Search context */
3635cf
 {
3635cf
   regfree((regex_t *)search);
3635cf
+  free(search);
3635cf
 }
3635cf
diff --git a/cups/http-addrlist.c b/cups/http-addrlist.c
3635cf
index 5d510140b..688901a7d 100644
3635cf
--- a/cups/http-addrlist.c
3635cf
+++ b/cups/http-addrlist.c
3635cf
@@ -612,6 +613,7 @@ httpAddrGetList(const char *hostname,	/* I - Hostname, IP address, or NULL for p
3635cf
 	  if (!temp)
3635cf
 	  {
3635cf
 	    httpAddrFreeList(first);
3635cf
+	    freeaddrinfo(results);
3635cf
 	    _cupsSetError(IPP_STATUS_ERROR_INTERNAL, strerror(errno), 0);
3635cf
 	    return (NULL);
3635cf
 	  }
3635cf
diff --git a/cups/http.c b/cups/http.c
3635cf
index a9235b087..d9332cc83 100644
3635cf
--- a/cups/http.c
3635cf
+++ b/cups/http.c
3635cf
@@ -3915,7 +3915,7 @@ http_create(
3635cf
   if ((http = calloc(sizeof(http_t), 1)) == NULL)
3635cf
   {
3635cf
     _cupsSetError(IPP_STATUS_ERROR_INTERNAL, strerror(errno), 0);
3635cf
-    httpAddrFreeList(addrlist);
3635cf
+    httpAddrFreeList(myaddrlist);
3635cf
     return (NULL);
3635cf
   }
3635cf
 
3635cf
diff --git a/ppdc/ppdc-source.cxx b/ppdc/ppdc-source.cxx
3635cf
index be24cebae..4e8cba7bb 100644
3635cf
--- a/ppdc/ppdc-source.cxx
3635cf
+++ b/ppdc/ppdc-source.cxx
3635cf
@@ -2665,6 +2666,7 @@ ppdcSource::scan_file(ppdcFile   *fp,	// I - File to read
3635cf
       // Add it to the current option...
3635cf
       if (!o)
3635cf
       {
3635cf
+        c->release();
3635cf
         _cupsLangPrintf(stderr,
3635cf
 	                _("ppdc: Choice found on line %d of %s with no "
3635cf
 			  "Option."), fp->line, fp->filename);
3635cf
diff --git a/scheduler/cups-driverd.cxx b/scheduler/cups-driverd.cxx
3635cf
index 657eee0a0..b518a9325 100644
3635cf
--- a/scheduler/cups-driverd.cxx
3635cf
+++ b/scheduler/cups-driverd.cxx
3635cf
@@ -153,7 +153,7 @@ static ppd_info_t	*add_ppd(const char *filename, const char *name,
3635cf
 				 size_t size, int model_number, int type,
3635cf
 				 const char *scheme);
3635cf
 static int		cat_drv(const char *name, int request_id);
3635cf
-static int		cat_ppd(const char *name, int request_id);
3635cf
+static void		cat_ppd(const char *name, int request_id);
3635cf
 static int		cat_static(const char *name, int request_id);
3635cf
 static int		cat_tar(const char *name, int request_id);
3635cf
 static int		compare_inodes(struct stat *a, struct stat *b);
3635cf
@@ -163,12 +163,12 @@ static int		compare_names(const ppd_info_t *p0,
3635cf
 			              const ppd_info_t *p1);
3635cf
 static int		compare_ppds(const ppd_info_t *p0,
3635cf
 			             const ppd_info_t *p1);
3635cf
-static int		dump_ppds_dat(const char *filename);
3635cf
+static void		dump_ppds_dat(const char *filename);
3635cf
 static void		free_array(cups_array_t *a);
3635cf
 static cups_file_t	*get_file(const char *name, int request_id,
3635cf
 			          const char *subdir, char *buffer,
3635cf
 			          size_t bufsize, char **subfile);
3635cf
-static int		list_ppds(int request_id, int limit, const char *opt);
3635cf
+static void		list_ppds(int request_id, int limit, const char *opt);
3635cf
 static int		load_drivers(cups_array_t *include,
3635cf
 			             cups_array_t *exclude);
3635cf
 static int		load_drv(const char *filename, const char *name,
3635cf
@@ -204,13 +204,13 @@ main(int  argc,				/* I - Number of command-line args */
3635cf
   */
3635cf
 
3635cf
   if (argc == 3 && !strcmp(argv[1], "cat"))
3635cf
-    return (cat_ppd(argv[2], 0));
3635cf
+    cat_ppd(argv[2], 0);
3635cf
   else if ((argc == 2 || argc == 3) && !strcmp(argv[1], "dump"))
3635cf
-    return (dump_ppds_dat(argv[2]));
3635cf
+    dump_ppds_dat(argv[2]);
3635cf
   else if (argc == 4 && !strcmp(argv[1], "get"))
3635cf
-    return (cat_ppd(argv[3], atoi(argv[2])));
3635cf
+    cat_ppd(argv[3], atoi(argv[2]));
3635cf
   else if (argc == 5 && !strcmp(argv[1], "list"))
3635cf
-    return (list_ppds(atoi(argv[2]), atoi(argv[3]), argv[4]));
3635cf
+    list_ppds(atoi(argv[2]), atoi(argv[3]), argv[4]);
3635cf
   else
3635cf
   {
3635cf
     fputs("Usage: cups-driverd cat ppd-name\n", stderr);
3635cf
@@ -428,7 +428,7 @@ cat_drv(const char *name,		/* I - PPD name */
3635cf
  * 'cat_ppd()' - Copy a PPD file to stdout.
3635cf
  */
3635cf
 
3635cf
-static int				/* O - Exit code */
3635cf
+static void
3635cf
 cat_ppd(const char *name,		/* I - PPD name */
3635cf
         int        request_id)		/* I - Request ID for response? */
3635cf
 {
3635cf
@@ -445,7 +445,7 @@ cat_ppd(const char *name,		/* I - PPD name */
3635cf
   if (strstr(name, "../"))
3635cf
   {
3635cf
     fputs("ERROR: Invalid PPD name.\n", stderr);
3635cf
-    return (1);
3635cf
+    exit(1);
3635cf
   }
3635cf
 
3635cf
   strlcpy(scheme, name, sizeof(scheme));
3635cf
@@ -475,11 +475,11 @@ cat_ppd(const char *name,		/* I - PPD name */
3635cf
     puts("Content-Type: application/ipp\n");
3635cf
 
3635cf
   if (!scheme[0])
3635cf
-    return (cat_static(name, request_id));
3635cf
+    exit(cat_static(name, request_id));
3635cf
   else if (!strcmp(scheme, "drv"))
3635cf
-    return (cat_drv(name, request_id));
3635cf
+    exit(cat_drv(name, request_id));
3635cf
   else if (!strcmp(scheme, "file"))
3635cf
-    return (cat_tar(name, request_id));
3635cf
+    exit(cat_tar(name, request_id));
3635cf
   else
3635cf
   {
3635cf
    /*
3635cf
@@ -517,7 +517,7 @@ cat_ppd(const char *name,		/* I - PPD name */
3635cf
         cupsdSendIPPTrailer();
3635cf
       }
3635cf
 
3635cf
-      return (1);
3635cf
+      exit(1);
3635cf
     }
3635cf
 
3635cf
    /*
3635cf
@@ -547,15 +547,15 @@ cat_ppd(const char *name,		/* I - PPD name */
3635cf
 
3635cf
       fprintf(stderr, "ERROR: [cups-driverd] Unable to execute \"%s\" - %s\n",
3635cf
               line, strerror(errno));
3635cf
-      return (1);
3635cf
+      exit(1);
3635cf
     }
3635cf
   }
3635cf
 
3635cf
  /*
3635cf
-  * Return with no errors...
3635cf
+  * Exit with no errors...
3635cf
   */
3635cf
 
3635cf
-  return (0);
3635cf
+  exit(0);
3635cf
 }
3635cf
 
3635cf
 
3635cf
@@ -778,7 +778,7 @@ compare_ppds(const ppd_info_t *p0,	/* I - First PPD file */
3635cf
  * 'dump_ppds_dat()' - Dump the contents of the ppds.dat file.
3635cf
  */
3635cf
 
3635cf
-static int				/* O - Exit status */
3635cf
+static void
3635cf
 dump_ppds_dat(const char *filename)	/* I - Filename */
3635cf
 {
3635cf
   char		temp[1024];		/* ppds.dat filename */
3635cf
@@ -810,7 +810,7 @@ dump_ppds_dat(const char *filename)	/* I - Filename */
3635cf
 	   ppd->record.make_and_model, ppd->record.device_id,
3635cf
 	   ppd->record.scheme);
3635cf
 
3635cf
-  return (0);
3635cf
+  exit(0);
3635cf
 }
3635cf
 
3635cf
 
3635cf
@@ -1004,7 +1004,7 @@ get_file(const char *name,		/* I - Name */
3635cf
  * 'list_ppds()' - List PPD files.
3635cf
  */
3635cf
 
3635cf
-static int				/* O - Exit code */
3635cf
+static void
3635cf
 list_ppds(int        request_id,	/* I - Request ID */
3635cf
           int        limit,		/* I - Limit */
3635cf
 	  const char *opt)		/* I - Option argument */
3635cf
@@ -1566,7 +1566,7 @@ list_ppds(int        request_id,	/* I - Request ID */
3635cf
   if (request_id)
3635cf
     cupsdSendIPPTrailer();
3635cf
 
3635cf
-  return (0);
3635cf
+  exit(0);
3635cf
 }
3635cf
 
3635cf
 
3635cf
-- 
3635cf
2.17.1
3635cf