#15 1964975 - cups: memory leaks in http_tls_upgrade() and _cupsEncodeOption()
Merged 8 months ago by zdohnal. Opened 8 months ago by rlescak.
Unknown source memleak-fixes  into  rawhide

@@ -0,0 +1,38 @@

+ From d9924186325c89aefa56e36258f56f246dd2c4ad Mon Sep 17 00:00:00 2001

+ From: Richard Lescak <rlescak@redhat.com>

+ Date: Tue, 11 Jan 2022 10:53:34 +0100

+ Subject: [PATCH] cups/http.c,encode.c: Fix memory leaks

+ 

+ ---

+  CHANGES.md    | 3 ++-

+  cups/encode.c | 1 +

+  cups/http.c   | 1 +

+  3 files changed, 4 insertions(+), 1 deletion(-)

+ 

+ diff --git a/cups/encode.c b/cups/encode.c

+ index 5bcbf6fe5..15b1c6b40 100644

+ --- a/cups/encode.c

+ +++ b/cups/encode.c

+ @@ -655,6 +655,7 @@ _cupsEncodeOption(

+  	  ippSetCollection(ipp, &attr, i, collection);

+  	  cupsEncodeOptions2(collection, num_cols, cols, IPP_TAG_JOB);

+  	  cupsFreeOptions(num_cols, cols);

+ +	  ippDelete(collection);

+  	  break;

+  

+        default :

+ diff --git a/cups/http.c b/cups/http.c

+ index bd41e6f8e..4b6a24bd3 100644

+ --- a/cups/http.c

+ +++ b/cups/http.c

+ @@ -4631,6 +4631,7 @@ http_tls_upgrade(http_t *http)		/* I - HTTP connection */

+    * Restore the HTTP request data...

+    */

+  

+ +  httpClearFields(http);

+    memcpy(http->_fields, myhttp._fields, sizeof(http->_fields));

+    memcpy(http->fields, myhttp.fields, sizeof(http->fields));

+  

+ -- 

+ 2.31.1

+ 

file modified
+8 -1
@@ -15,7 +15,7 @@

  Name: cups

  Epoch: 1

  Version: 2.4.0

- Release: 1%{?dist}

+ Release: 2%{?dist}

  License: ASL 2.0

  Url: https://openprinting.github.io/cups/

  # Apple stopped uploading the new versions into github, use OpenPrinting fork
@@ -69,6 +69,9 @@

  #### UPSTREAM PATCHES (starts with 1000) ####

  Patch1000: cups-service-typo.patch

  Patch1001: 0001-de-index.html-Fix-missing-bracket-fixes-issue-299.patch

+ # Memory leak fixes (bug #1964975)

+ # https://github.com/OpenPrinting/cups/pull/322

+ Patch1002: 0001-cups-http-encode-memleaks-fixes-issue-322.patch

  

  ##### Patches removed because IMHO they aren't no longer needed

  ##### but still I'll leave them in git in case their removal
@@ -271,6 +274,7 @@

  # UPSTREAM PATCHES

  %patch1000 -p1 -b .service-typo

  %patch1001 -p1 -b .de-index-missing-bracket

+ %patch1002 -p1 -b .memleak-fixes

  

  

  %if %{lspp}
@@ -652,6 +656,9 @@

  %{_mandir}/man7/ippeveps.7.gz

  

  %changelog

+ * Wed Jan 12 2022 Richard Lescak <rlescak@redhat.com> - 1:2.4.0-2

+ - 1964975 - cups: memory leaks in http_tls_upgrade() and _cupsEncodeOption()

+ 

  * Tue Jan 04 2022 Zdenek Dohnal <zdohnal@redhat.com> - 1:2.4.0-1

  - 2027497 - cups-2.4.0 is available

  

no initial comment

@rlescak This is not backported from upstream + indentation is wrong. Please backport the patch from upstream.

rebased onto 0cbef17

8 months ago

@rlescak LGTM now, thx for the PR! :)

Pull-Request has been merged by zdohnal

8 months ago