[cups] Polished patches according to results from static analysis of code (bug #690130).
Jiří Popelka
jpopelka at fedoraproject.org
Fri Mar 25 16:01:46 UTC 2011
commit 85d072c20bb9f77647a79ef55d1acfb15f818e6b
Author: Jiri Popelka <jpopelka at redhat.com>
Date: Fri Mar 25 16:56:11 2011 +0100
Polished patches according to results from static analysis of code (bug #690130).
cups-avahi.patch | 8 +++++---
cups-icc.patch | 4 +---
cups-lspp.patch | 16 ++++++++++------
cups.spec | 5 ++++-
4 files changed, 20 insertions(+), 13 deletions(-)
---
diff --git a/cups-avahi.patch b/cups-avahi.patch
index 3841468..0626945 100644
--- a/cups-avahi.patch
+++ b/cups-avahi.patch
@@ -1139,7 +1139,7 @@ diff -up cups-1.4.6/cups/http-support.c.avahi cups-1.4.6/cups/http-support.c
diff -up cups-1.4.6/scheduler/avahi.c.avahi cups-1.4.6/scheduler/avahi.c
--- cups-1.4.6/scheduler/avahi.c.avahi 2011-01-25 13:26:16.640115190 +0000
+++ cups-1.4.6/scheduler/avahi.c 2011-01-25 13:26:16.640115190 +0000
-@@ -0,0 +1,443 @@
+@@ -0,0 +1,445 @@
+/*
+ * "$Id$"
+ *
@@ -1342,8 +1342,10 @@ diff -up cups-1.4.6/scheduler/avahi.c.avahi cups-1.4.6/scheduler/avahi.c
+ watched_fd = cupsArrayFind (cups_poll->watched_fds, &key);
+ if (watched_fd == NULL) {
+ watched_fd = malloc(sizeof(cupsd_watched_fd_t));
-+ if (watched_fd == NULL)
++ if (watched_fd == NULL) {
++ free (watch);
+ return (NULL);
++ }
+
+ watched_fd->fd = fd;
+ watched_fd->occurred = 0;
@@ -2795,7 +2797,7 @@ diff -up cups-1.4.6/scheduler/dirsvc.c.avahi cups-1.4.6/scheduler/dirsvc.c
+ AvahiStringList *strlst = NULL;
+ char **elements;
+ size_t len;
-+ int i;
++ int i = 0;
+
+ elements = malloc ((1 + count) * sizeof (char *));
+ if (!elements)
diff --git a/cups-icc.patch b/cups-icc.patch
index 3132173..86d992c 100644
--- a/cups-icc.patch
+++ b/cups-icc.patch
@@ -15,7 +15,7 @@ new file mode 100644
index 0000000..2fdf401
--- /dev/null
+++ b/scheduler/colord.c
-@@ -0,0 +1,665 @@
+@@ -0,0 +1,663 @@
+/*
+ * "$Id$"
+ *
@@ -612,8 +612,6 @@ index 0000000..2fdf401
+ COLORD_SCOPE_TEMP);
+ break;
+ case PPD_CS_GRAY :
-+ if (attr)
-+ break;
+ case PPD_CS_N :
+ colordCreateProfile(profiles,
+ p->name,
diff --git a/cups-lspp.patch b/cups-lspp.patch
index 85bd4ba..5ab87bd 100644
--- a/cups-lspp.patch
+++ b/cups-lspp.patch
@@ -957,7 +957,7 @@ diff -urNp cups-1.4.6.old/filter/common.c cups-1.4.6/filter/common.c
+ {
+ lines = 1 + (int)(label_len / max_width);
+ line_len = (int)(label_len / lines);
-+ wrapped_label = malloc(sizeof(wrapped_label) * lines);
++ wrapped_label = malloc(sizeof(*wrapped_label) * lines);
+ label_index = i = n = 0;
+ while (classification[label_index])
+ {
@@ -989,7 +989,7 @@ diff -urNp cups-1.4.6.old/filter/common.c cups-1.4.6/filter/common.c
+ else
+ {
+ lines = 1;
-+ wrapped_label = malloc(sizeof(wrapped_label));
++ wrapped_label = malloc(sizeof(*wrapped_label));
+ wrapped_label[0] = (char*)classification;
+ }
+
@@ -1115,7 +1115,7 @@ diff -urNp cups-1.4.6.old/filter/pstops.c cups-1.4.6/filter/pstops.c
+ {
+ lines = 1 + (int)(label_len / max_width);
+ line_len = (int)(label_len / lines);
-+ wrapped_label = malloc(sizeof(wrapped_label) * lines);
++ wrapped_label = malloc(sizeof(*wrapped_label) * lines);
+ label_index = i = n = 0;
+ while (classification[label_index])
+ {
@@ -1147,7 +1147,7 @@ diff -urNp cups-1.4.6.old/filter/pstops.c cups-1.4.6/filter/pstops.c
+ else
+ {
+ lines = 1;
-+ wrapped_label = malloc(sizeof(wrapped_label));
++ wrapped_label = malloc(sizeof(*wrapped_label));
+ wrapped_label[0] = (char*)classification;
+ }
+
@@ -1963,7 +1963,7 @@ diff -urNp cups-1.4.6.old/scheduler/ipp.c cups-1.4.6/scheduler/ipp.c
/*
* See if we need to add the starting sheet...
-@@ -4295,6 +4527,107 @@ check_rss_recipient(
+@@ -4295,6 +4527,111 @@ check_rss_recipient(
}
@@ -2022,7 +2022,11 @@ diff -urNp cups-1.4.6.old/scheduler/ipp.c cups-1.4.6/scheduler/ipp.c
+ cupsdLogMessage(CUPSD_LOG_ERROR, "check_context: unable to convert %s to SELinux sid", con->scon);
+ return -1;
+ }
-+ avc_context_to_sid(job->scon, &jobsid);
++ if (avc_context_to_sid(job->scon, &jobsid) != 0)
++ {
++ cupsdLogMessage(CUPSD_LOG_ERROR, "check_context: unable to convert %s to SELinux sid", job->scon);
++ return -1;
++ }
+ avc_entry_ref_init(&avcref);
+ tclass = SECCLASS_FILE;
+ avr = FILE__READ;
diff --git a/cups.spec b/cups.spec
index d958ab1..24834da 100644
--- a/cups.spec
+++ b/cups.spec
@@ -13,7 +13,7 @@
Summary: Common Unix Printing System
Name: cups
Version: 1.4.6
-Release: 14%{?dist}
+Release: 15%{?dist}
License: GPLv2
Group: System Environment/Daemons
Source: http://ftp.easysw.com/pub/cups/%{version}/cups-%{version}-source.tar.bz2
@@ -610,6 +610,9 @@ rm -rf $RPM_BUILD_ROOT
%{php_extdir}/phpcups.so
%changelog
+* Fri Mar 25 2011 Jiri Popelka <jpopelka at redhat.com> 1:1.4.6-15
+- Polished patches according to results from static analysis of code (bug #690130).
+
* Thu Mar 10 2011 Tim Waugh <twaugh at redhat.com> 1:1.4.6-14
- Fixed some typos in colord patch.
- LSPP: only warn when unable to get printer context.
More information about the scm-commits
mailing list