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

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