fix leaks in cups-browsed

add require on nss-mdns
This commit is contained in:
Zdenek Dohnal 2020-03-20 06:37:18 +01:00
parent 890dbaf30a
commit 1fc0a67de9
2 changed files with 106 additions and 1 deletions

95
cups-browsed-leaks.patch Normal file
View File

@ -0,0 +1,95 @@
diff --git a/utils/cups-browsed.c b/utils/cups-browsed.c
index 77efa583..dd0fcbb3 100644
--- a/utils/cups-browsed.c
+++ b/utils/cups-browsed.c
@@ -6278,6 +6278,7 @@ on_job_state (CupsNotifier *object,
}
ippDelete(response);
+ response = NULL;
} else
debug_printf("IPP request to %s:%d failed.\n", p->host,
p->port);
@@ -8070,7 +8071,7 @@ gboolean update_cups_queues(gpointer unused) {
debug_printf("Default page size: %s\n",
default_page_size);
p->num_options = cupsAddOption("media-default",
- strdup(default_page_size),
+ default_page_size,
p->num_options, &(p->options));
} else {
attr = ippFindAttribute(p->prattrs,
@@ -8081,7 +8082,7 @@ gboolean update_cups_queues(gpointer unused) {
debug_printf("Default page size: %s\n",
default_page_size);
p->num_options = cupsAddOption("media-default",
- strdup(default_page_size),
+ default_page_size,
p->num_options, &(p->options));
} else
debug_printf("No default page size found!\n");
@@ -8101,7 +8102,7 @@ gboolean update_cups_queues(gpointer unused) {
bottom = 1270;
snprintf(buffer, sizeof(buffer), "%d", bottom);
p->num_options = cupsAddOption("media-bottom-margin-default",
- strdup(buffer),
+ buffer,
p->num_options, &(p->options));
if ((attr = ippFindAttribute(p->prattrs,
@@ -8117,7 +8118,7 @@ gboolean update_cups_queues(gpointer unused) {
left = 635;
snprintf(buffer, sizeof(buffer), "%d", left);
p->num_options = cupsAddOption("media-left-margin-default",
- strdup(buffer),
+ buffer,
p->num_options, &(p->options));
if ((attr = ippFindAttribute(p->prattrs,
@@ -8133,7 +8134,7 @@ gboolean update_cups_queues(gpointer unused) {
right = 635;
snprintf(buffer, sizeof(buffer), "%d", right);
p->num_options = cupsAddOption("media-right-margin-default",
- strdup(buffer),
+ buffer,
p->num_options, &(p->options));
if ((attr = ippFindAttribute(p->prattrs,
@@ -8149,7 +8150,7 @@ gboolean update_cups_queues(gpointer unused) {
top = 1270;
snprintf(buffer, sizeof(buffer), "%d", top);
p->num_options = cupsAddOption("media-top-margin-default",
- strdup(buffer),
+ buffer,
p->num_options, &(p->options));
debug_printf("Margins: Left: %d, Right: %d, Top: %d, Bottom: %d\n",
@@ -8170,7 +8171,7 @@ gboolean update_cups_queues(gpointer unused) {
debug_printf("Best color space: %s\n",
best_color_space);
p->num_options = cupsAddOption("print-color-mode-default",
- strdup(best_color_space),
+ best_color_space,
p->num_options, &(p->options));
} else {
debug_printf("No info about supported color spaces found!\n");
@@ -8185,7 +8186,7 @@ gboolean update_cups_queues(gpointer unused) {
p->num_options, &(p->options));
p->num_options = cupsAddOption("output-format-default",
- strdup(p->pdl),
+ p->pdl,
p->num_options, &(p->options));
p->num_options = cupsAddOption("make-and-model-default",
remove_bad_chars(p->make_model, 0),
@@ -8527,8 +8528,8 @@ gboolean update_cups_queues(gpointer unused) {
/* Default option settings from printer entry */
for (i = 0; i < p->num_options; i ++)
if (strcasecmp(p->options[i].name, "printer-is-shared"))
- num_options = cupsAddOption(strdup(p->options[i].name),
- strdup(p->options[i].value),
+ num_options = cupsAddOption(p->options[i].name,
+ p->options[i].value,
num_options, &options);
/* Encode option list into IPP attributes */
cupsEncodeOptions2(request, num_options, options, IPP_TAG_OPERATION);

View File

@ -4,7 +4,7 @@
Summary: OpenPrinting CUPS filters and backends
Name: cups-filters
Version: 1.27.2
Release: 1%{?dist}
Release: 2%{?dist}
# For a breakdown of the licensing, see COPYING file
# GPLv2: filters: commandto*, imagetoraster, pdftops, rasterto*,
@ -30,6 +30,7 @@ Patch02: cups-browsed.8.patch
# Segfaults in test suite when test font is missing
# https://github.com/OpenPrinting/cups-filters/pull/214
Patch03: 0001-Fix-segfaults-in-test-suite-when-test-font-is-missin.patch
Patch04: cups-browsed-leaks.patch
Requires: cups-filters-libs%{?_isa} = %{version}-%{release}
@ -109,6 +110,10 @@ Requires(post): systemd
Requires(preun): systemd
Requires(postun): systemd
# cups-browsed needs nss-mdns for resolving .local addresses of remote print queues
# or device during discovery
Requires: nss-mdns
%package libs
Summary: OpenPrinting CUPS filters and backends - cupsfilters and fontembed libraries
# LGPLv2: libcupsfilters
@ -141,6 +146,7 @@ This is the development package for OpenPrinting CUPS filters and backends.
# links in manpage
%patch02 -p1 -b .manpage
%patch03 -p1 -b .fontemb
%patch04 -p1 -b .memleaks
%build
# work-around Rpath
@ -307,6 +313,10 @@ done
%{_libdir}/libfontembed.so
%changelog
* Fri Mar 13 2020 Zdenek Dohnal <zdohnal@redhat.com> - 1.27.2-2
- fix leaks in cups-browsed
- add require on nss-mdns
* Mon Mar 02 2020 Zdenek Dohnal <zdohnal@redhat.com> - 1.27.2-1
- 1.27.2