fix memory leak during device discovery

This commit is contained in:
Zdenek Dohnal 2020-11-24 11:56:24 +01:00
parent 68ee05f690
commit 82c55743e5
2 changed files with 53 additions and 1 deletions

View File

@ -0,0 +1,47 @@
From e38d6dc448dcb19247280b4adf63b89d673b8666 Mon Sep 17 00:00:00 2001
From: Michael R Sweet <msweet@msweet.org>
Date: Mon, 23 Nov 2020 22:15:26 -0500
Subject: [PATCH] Fix memory leak (Issue #49)
---
CHANGES-OPENPRINTING.md | 1 +
cups/http-support.c | 9 +++++++--
2 files changed, 8 insertions(+), 2 deletions(-)
diff --git a/cups/http-support.c b/cups/http-support.c
index 521b7e06b..b0506c976 100644
--- a/cups/http-support.c
+++ b/cups/http-support.c
@@ -1,8 +1,9 @@
/*
* HTTP support routines for CUPS.
*
- * Copyright 2007-2019 by Apple Inc.
- * Copyright 1997-2007 by Easy Software Products, all rights reserved.
+ * Copyright © 2020 by Michael R Sweet
+ * Copyright © 2007-2019 by Apple Inc.
+ * Copyright © 1997-2007 by Easy Software Products, all rights reserved.
*
* Licensed under Apache License v2.0. See the file "LICENSE" for more
* information.
@@ -2545,6 +2546,8 @@ http_resolve_cb(
memcpy(uuid, value, valueLen);
uuid[valueLen] = '\0';
+ avahi_free(value);
+
if (_cups_strcasecmp(uuid, uribuf->uuid))
{
if (uribuf->options & _HTTP_RESOLVE_STDERR)
@@ -2629,6 +2632,8 @@ http_resolve_cb(
memcpy(resource + 1, value, valueLen);
resource[valueLen + 1] = '\0';
}
+
+ avahi_free(value);
}
else
{
--
2.26.2

View File

@ -15,7 +15,7 @@ Summary: CUPS printing system
Name: cups
Epoch: 1
Version: 2.3.3
Release: 19%{?dist}
Release: 20%{?dist}
License: ASL 2.0
Url: http://www.cups.org/
Source0: https://github.com/apple/cups/releases/download/v%{VERSION}/cups-%{VERSION}-source.tar.gz
@ -123,6 +123,7 @@ Patch29: cups-manual-copies.patch
# freed as a different attribute type than it was allocated
# backported from upstream https://github.com/OpenPrinting/cups/pull/43
Patch30: 0001-backend-scheduler-ipp.c-Fix-printer-alert-invalid-fr.patch
Patch31: 0001-Fix-memory-leak-Issue-49.patch
##### Patches removed because IMHO they aren't no longer needed
##### but still I'll leave them in git in case their removal
@ -342,6 +343,7 @@ to CUPS daemon. This solution will substitute printer drivers and raw queues in
%patch28 -p1 -b .ipptool-mdns-uri
%patch29 -p1 -b .manual-copies
%patch30 -p1 -b .printer-alert
%patch31 -p1 -b .avahi-leak
# if cupsd is set to log into /var/log/cups, then 'MaxLogSize 0' needs to be
@ -768,6 +770,9 @@ rm -f %{cups_serverbin}/backend/smb
%{_mandir}/man7/ippevepcl.7.gz
%changelog
* Tue Nov 24 2020 Zdenek Dohnal <zdohnal@redhat.com> - 1:2.3.3-20
- fix memory leak during device discovery
* Thu Nov 12 2020 Zdenek Dohnal <zdohnal@redhat.com> - 1:2.3.3-19
- 1897023 - Cups service restart sequence during upgrade incorrect