Fix memory leaks in cups-browsed (bug #1027317)

This commit is contained in:
Jaromír Končický 2013-11-14 10:57:30 +01:00
parent f7177f4071
commit af64aeb120
2 changed files with 44 additions and 1 deletions

View File

@ -0,0 +1,36 @@
diff --git a/utils/cups-browsed.c b/utils/cups-browsed.c
index c312804..155b581 100644
--- a/utils/cups-browsed.c
+++ b/utils/cups-browsed.c
@@ -993,6 +993,10 @@ void generate_local_queue(const char *host,
would get, so ignore this remote printer */
debug_printf("cups-browsed: Printer with URI %s already exists, printer ignored.\n",
uri);
+ free (uri);
+ free (remote_host);
+ free (backup_queue_name);
+ cupsFreeDests(num_dests, dests);
return;
}
/* Is there a local queue with the name of the remote queue? */
@@ -1027,6 +1031,7 @@ void generate_local_queue(const char *host,
ignore this remote printer */
debug_printf("cups-browsed: %s also taken, printer ignored.\n",
local_queue_name);
+ free (uri);
free (backup_queue_name);
free (remote_host);
cupsFreeDests(num_dests, dests);
@@ -2426,9 +2431,9 @@ int main(int argc, char*argv[]) {
strcasecmp(val, "false") != 0) {
/* Queue found, add to our list */
p = create_local_queue (dest->name,
- strdup(cupsGetOption("device-uri",
- dest->num_options,
- dest->options)),
+ cupsGetOption("device-uri",
+ dest->num_options,
+ dest->options),
"", "", "", "", NULL, 1);
if (p) {
/* Mark as unconfirmed, if no Avahi report of this queue appears

View File

@ -4,7 +4,7 @@
Summary: OpenPrinting CUPS filters and backends
Name: cups-filters
Version: 1.0.41
Release: 2%{?dist}
Release: 3%{?dist}
# For a breakdown of the licensing, see COPYING file
# GPLv2: filters: commandto*, imagetoraster, pdftops, rasterto*,
@ -23,6 +23,7 @@ Source0: http://www.openprinting.org/download/cups-filters/cups-filters-%{versio
Patch1: cups-filters-pdf-landscape.patch
Patch2: cups-filters-dbus.patch
Patch3: cups-filters-memory-leaks.patch
Requires: cups-filters-libs%{?_isa} = %{version}-%{release}
@ -112,6 +113,9 @@ This is the development package for OpenPrinting CUPS filters and backends.
# Include dbus so that colord support works (bug #1026928).
%patch2 -p1 -b .dbus
# Fix memory leaks in cups-browsed (bug #1027317).
%patch3 -p1 -b .memory-leaks
%build
# work-around Rpath
./autogen.sh
@ -226,6 +230,9 @@ fi
%{_libdir}/libfontembed.so
%changelog
* Thu Nov 14 2013 Jaromír Končický <jkoncick@redhat.com> - 1.0.41-3
- Fix memory leaks in cups-browsed (bug #1027317).
* Wed Nov 6 2013 Tim Waugh <twaugh@redhat.com> - 1.0.41-2
- Include dbus so that colord support works (bug #1026928).