fixed coverity issues
This commit is contained in:
parent
24d583ff4c
commit
e9cb4a1905
206
0001-Fix-memory-leaks-found-by-Coverity-Issue-5375.patch
Normal file
206
0001-Fix-memory-leaks-found-by-Coverity-Issue-5375.patch
Normal file
@ -0,0 +1,206 @@
|
|||||||
|
diff --git a/backend/ipp.c b/backend/ipp.c
|
||||||
|
index 32eb3aaa4..2a880bd75 100644
|
||||||
|
--- a/backend/ipp.c
|
||||||
|
+++ b/backend/ipp.c
|
||||||
|
@@ -3612,6 +3612,8 @@ update_reasons(ipp_attribute_t *attr, /* I - printer-state-reasons or NULL */
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
+ cupsArrayDelete(new_reasons);
|
||||||
|
+
|
||||||
|
_cupsMutexUnlock(&report_mutex);
|
||||||
|
|
||||||
|
/*
|
||||||
|
diff --git a/cgi-bin/search.c b/cgi-bin/search.c
|
||||||
|
index 3956afc33..ad1f5ed0e 100644
|
||||||
|
--- a/cgi-bin/search.c
|
||||||
|
+++ b/cgi-bin/search.c
|
||||||
|
@@ -361,4 +362,5 @@ void
|
||||||
|
cgiFreeSearch(void *search) /* I - Search context */
|
||||||
|
{
|
||||||
|
regfree((regex_t *)search);
|
||||||
|
+ free(search);
|
||||||
|
}
|
||||||
|
diff --git a/cups/http-addrlist.c b/cups/http-addrlist.c
|
||||||
|
index 5d510140b..688901a7d 100644
|
||||||
|
--- a/cups/http-addrlist.c
|
||||||
|
+++ b/cups/http-addrlist.c
|
||||||
|
@@ -612,6 +613,7 @@ httpAddrGetList(const char *hostname, /* I - Hostname, IP address, or NULL for p
|
||||||
|
if (!temp)
|
||||||
|
{
|
||||||
|
httpAddrFreeList(first);
|
||||||
|
+ freeaddrinfo(results);
|
||||||
|
_cupsSetError(IPP_STATUS_ERROR_INTERNAL, strerror(errno), 0);
|
||||||
|
return (NULL);
|
||||||
|
}
|
||||||
|
diff --git a/cups/http.c b/cups/http.c
|
||||||
|
index a9235b087..d9332cc83 100644
|
||||||
|
--- a/cups/http.c
|
||||||
|
+++ b/cups/http.c
|
||||||
|
@@ -3915,7 +3915,7 @@ http_create(
|
||||||
|
if ((http = calloc(sizeof(http_t), 1)) == NULL)
|
||||||
|
{
|
||||||
|
_cupsSetError(IPP_STATUS_ERROR_INTERNAL, strerror(errno), 0);
|
||||||
|
- httpAddrFreeList(addrlist);
|
||||||
|
+ httpAddrFreeList(myaddrlist);
|
||||||
|
return (NULL);
|
||||||
|
}
|
||||||
|
|
||||||
|
diff --git a/ppdc/ppdc-source.cxx b/ppdc/ppdc-source.cxx
|
||||||
|
index be24cebae..4e8cba7bb 100644
|
||||||
|
--- a/ppdc/ppdc-source.cxx
|
||||||
|
+++ b/ppdc/ppdc-source.cxx
|
||||||
|
@@ -2665,6 +2666,7 @@ ppdcSource::scan_file(ppdcFile *fp, // I - File to read
|
||||||
|
// Add it to the current option...
|
||||||
|
if (!o)
|
||||||
|
{
|
||||||
|
+ c->release();
|
||||||
|
_cupsLangPrintf(stderr,
|
||||||
|
_("ppdc: Choice found on line %d of %s with no "
|
||||||
|
"Option."), fp->line, fp->filename);
|
||||||
|
diff --git a/scheduler/cups-driverd.cxx b/scheduler/cups-driverd.cxx
|
||||||
|
index 657eee0a0..b518a9325 100644
|
||||||
|
--- a/scheduler/cups-driverd.cxx
|
||||||
|
+++ b/scheduler/cups-driverd.cxx
|
||||||
|
@@ -153,7 +153,7 @@ static ppd_info_t *add_ppd(const char *filename, const char *name,
|
||||||
|
size_t size, int model_number, int type,
|
||||||
|
const char *scheme);
|
||||||
|
static int cat_drv(const char *name, int request_id);
|
||||||
|
-static int cat_ppd(const char *name, int request_id);
|
||||||
|
+static void cat_ppd(const char *name, int request_id);
|
||||||
|
static int cat_static(const char *name, int request_id);
|
||||||
|
static int cat_tar(const char *name, int request_id);
|
||||||
|
static int compare_inodes(struct stat *a, struct stat *b);
|
||||||
|
@@ -163,12 +163,12 @@ static int compare_names(const ppd_info_t *p0,
|
||||||
|
const ppd_info_t *p1);
|
||||||
|
static int compare_ppds(const ppd_info_t *p0,
|
||||||
|
const ppd_info_t *p1);
|
||||||
|
-static int dump_ppds_dat(const char *filename);
|
||||||
|
+static void dump_ppds_dat(const char *filename);
|
||||||
|
static void free_array(cups_array_t *a);
|
||||||
|
static cups_file_t *get_file(const char *name, int request_id,
|
||||||
|
const char *subdir, char *buffer,
|
||||||
|
size_t bufsize, char **subfile);
|
||||||
|
-static int list_ppds(int request_id, int limit, const char *opt);
|
||||||
|
+static void list_ppds(int request_id, int limit, const char *opt);
|
||||||
|
static int load_drivers(cups_array_t *include,
|
||||||
|
cups_array_t *exclude);
|
||||||
|
static int load_drv(const char *filename, const char *name,
|
||||||
|
@@ -204,13 +204,13 @@ main(int argc, /* I - Number of command-line args */
|
||||||
|
*/
|
||||||
|
|
||||||
|
if (argc == 3 && !strcmp(argv[1], "cat"))
|
||||||
|
- return (cat_ppd(argv[2], 0));
|
||||||
|
+ cat_ppd(argv[2], 0);
|
||||||
|
else if ((argc == 2 || argc == 3) && !strcmp(argv[1], "dump"))
|
||||||
|
- return (dump_ppds_dat(argv[2]));
|
||||||
|
+ dump_ppds_dat(argv[2]);
|
||||||
|
else if (argc == 4 && !strcmp(argv[1], "get"))
|
||||||
|
- return (cat_ppd(argv[3], atoi(argv[2])));
|
||||||
|
+ cat_ppd(argv[3], atoi(argv[2]));
|
||||||
|
else if (argc == 5 && !strcmp(argv[1], "list"))
|
||||||
|
- return (list_ppds(atoi(argv[2]), atoi(argv[3]), argv[4]));
|
||||||
|
+ list_ppds(atoi(argv[2]), atoi(argv[3]), argv[4]);
|
||||||
|
else
|
||||||
|
{
|
||||||
|
fputs("Usage: cups-driverd cat ppd-name\n", stderr);
|
||||||
|
@@ -428,7 +428,7 @@ cat_drv(const char *name, /* I - PPD name */
|
||||||
|
* 'cat_ppd()' - Copy a PPD file to stdout.
|
||||||
|
*/
|
||||||
|
|
||||||
|
-static int /* O - Exit code */
|
||||||
|
+static void
|
||||||
|
cat_ppd(const char *name, /* I - PPD name */
|
||||||
|
int request_id) /* I - Request ID for response? */
|
||||||
|
{
|
||||||
|
@@ -445,7 +445,7 @@ cat_ppd(const char *name, /* I - PPD name */
|
||||||
|
if (strstr(name, "../"))
|
||||||
|
{
|
||||||
|
fputs("ERROR: Invalid PPD name.\n", stderr);
|
||||||
|
- return (1);
|
||||||
|
+ exit(1);
|
||||||
|
}
|
||||||
|
|
||||||
|
strlcpy(scheme, name, sizeof(scheme));
|
||||||
|
@@ -475,11 +475,11 @@ cat_ppd(const char *name, /* I - PPD name */
|
||||||
|
puts("Content-Type: application/ipp\n");
|
||||||
|
|
||||||
|
if (!scheme[0])
|
||||||
|
- return (cat_static(name, request_id));
|
||||||
|
+ exit(cat_static(name, request_id));
|
||||||
|
else if (!strcmp(scheme, "drv"))
|
||||||
|
- return (cat_drv(name, request_id));
|
||||||
|
+ exit(cat_drv(name, request_id));
|
||||||
|
else if (!strcmp(scheme, "file"))
|
||||||
|
- return (cat_tar(name, request_id));
|
||||||
|
+ exit(cat_tar(name, request_id));
|
||||||
|
else
|
||||||
|
{
|
||||||
|
/*
|
||||||
|
@@ -517,7 +517,7 @@ cat_ppd(const char *name, /* I - PPD name */
|
||||||
|
cupsdSendIPPTrailer();
|
||||||
|
}
|
||||||
|
|
||||||
|
- return (1);
|
||||||
|
+ exit(1);
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
@@ -547,15 +547,15 @@ cat_ppd(const char *name, /* I - PPD name */
|
||||||
|
|
||||||
|
fprintf(stderr, "ERROR: [cups-driverd] Unable to execute \"%s\" - %s\n",
|
||||||
|
line, strerror(errno));
|
||||||
|
- return (1);
|
||||||
|
+ exit(1);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
- * Return with no errors...
|
||||||
|
+ * Exit with no errors...
|
||||||
|
*/
|
||||||
|
|
||||||
|
- return (0);
|
||||||
|
+ exit(0);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@@ -778,7 +778,7 @@ compare_ppds(const ppd_info_t *p0, /* I - First PPD file */
|
||||||
|
* 'dump_ppds_dat()' - Dump the contents of the ppds.dat file.
|
||||||
|
*/
|
||||||
|
|
||||||
|
-static int /* O - Exit status */
|
||||||
|
+static void
|
||||||
|
dump_ppds_dat(const char *filename) /* I - Filename */
|
||||||
|
{
|
||||||
|
char temp[1024]; /* ppds.dat filename */
|
||||||
|
@@ -810,7 +810,7 @@ dump_ppds_dat(const char *filename) /* I - Filename */
|
||||||
|
ppd->record.make_and_model, ppd->record.device_id,
|
||||||
|
ppd->record.scheme);
|
||||||
|
|
||||||
|
- return (0);
|
||||||
|
+ exit(0);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@@ -1004,7 +1004,7 @@ get_file(const char *name, /* I - Name */
|
||||||
|
* 'list_ppds()' - List PPD files.
|
||||||
|
*/
|
||||||
|
|
||||||
|
-static int /* O - Exit code */
|
||||||
|
+static void
|
||||||
|
list_ppds(int request_id, /* I - Request ID */
|
||||||
|
int limit, /* I - Limit */
|
||||||
|
const char *opt) /* I - Option argument */
|
||||||
|
@@ -1566,7 +1566,7 @@ list_ppds(int request_id, /* I - Request ID */
|
||||||
|
if (request_id)
|
||||||
|
cupsdSendIPPTrailer();
|
||||||
|
|
||||||
|
- return (0);
|
||||||
|
+ exit(0);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
--
|
||||||
|
2.17.1
|
||||||
|
|
@ -15,7 +15,7 @@ Summary: CUPS printing system
|
|||||||
Name: cups
|
Name: cups
|
||||||
Epoch: 1
|
Epoch: 1
|
||||||
Version: 2.2.8
|
Version: 2.2.8
|
||||||
Release: 4%{?dist}
|
Release: 5%{?dist}
|
||||||
License: GPLv2+ and LGPLv2+ with exceptions and AML
|
License: GPLv2+ and LGPLv2+ with exceptions and AML
|
||||||
Url: http://www.cups.org/
|
Url: http://www.cups.org/
|
||||||
Source0: https://github.com/apple/cups/releases/download/v%{VERSION}/cups-%{VERSION}-source.tar.gz
|
Source0: https://github.com/apple/cups/releases/download/v%{VERSION}/cups-%{VERSION}-source.tar.gz
|
||||||
@ -103,6 +103,8 @@ Patch42: cups-epson-A6-crash.patch
|
|||||||
Patch43: cups-ippvalidateattr-regression.patch
|
Patch43: cups-ippvalidateattr-regression.patch
|
||||||
# IPP everywhere driver isn't in web UI (upstream https://github.com/apple/cups/issues/5338)
|
# IPP everywhere driver isn't in web UI (upstream https://github.com/apple/cups/issues/5338)
|
||||||
Patch44: cups-ippeve-webui.patch
|
Patch44: cups-ippeve-webui.patch
|
||||||
|
# fixed covscan issues from upstream
|
||||||
|
Patch45: 0001-Fix-memory-leaks-found-by-Coverity-Issue-5375.patch
|
||||||
|
|
||||||
##### Patches removed because IMHO they aren't no longer needed
|
##### Patches removed because IMHO they aren't no longer needed
|
||||||
##### but still I'll leave them in git in case their removal
|
##### but still I'll leave them in git in case their removal
|
||||||
@ -348,6 +350,8 @@ Sends IPP requests to the specified URI and tests and/or displays the results.
|
|||||||
%patch42 -p1 -b .epson-A6-crash
|
%patch42 -p1 -b .epson-A6-crash
|
||||||
%patch43 -p1 -b .ippvalidateattr-regression
|
%patch43 -p1 -b .ippvalidateattr-regression
|
||||||
%patch44 -p1 -b .ippeve-webui
|
%patch44 -p1 -b .ippeve-webui
|
||||||
|
# fixed covscan issues from upstream
|
||||||
|
%patch45 -p1 -b .covscan
|
||||||
|
|
||||||
# if cupsd is set to log into /var/log/cups, then 'MaxLogSize 0' needs to be
|
# if cupsd is set to log into /var/log/cups, then 'MaxLogSize 0' needs to be
|
||||||
# in cupsd.conf to disable cupsd logrotate functionality and use logrotated
|
# in cupsd.conf to disable cupsd logrotate functionality and use logrotated
|
||||||
@ -741,6 +745,9 @@ rm -f %{cups_serverbin}/backend/smb
|
|||||||
%{_mandir}/man5/ipptoolfile.5.gz
|
%{_mandir}/man5/ipptoolfile.5.gz
|
||||||
|
|
||||||
%changelog
|
%changelog
|
||||||
|
* Fri Sep 21 2018 Zdenek Dohnal <zdohnal@redhat.com> - 1:2.2.8-5
|
||||||
|
- fixed coverity issues
|
||||||
|
|
||||||
* Wed Sep 19 2018 Zdenek Dohnal <zdohnal@redhat.com> - 1:2.2.8-4
|
* Wed Sep 19 2018 Zdenek Dohnal <zdohnal@redhat.com> - 1:2.2.8-4
|
||||||
- 1618018 - Make cups systemd unit files more upstream-like
|
- 1618018 - Make cups systemd unit files more upstream-like
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user