From 5910c99b9211641e0691b2d418ee546af54c7a8c Mon Sep 17 00:00:00 2001 From: Michael R Sweet Date: Fri, 11 Apr 2025 10:40:38 -0400 Subject: [PATCH] Fix memory leak in httpClose (Issue #1223) --- CHANGES.md | 9 ++++++++- cups/http.c | 8 +++++++- 2 files changed, 15 insertions(+), 2 deletions(-) diff --git a/CHANGES.md b/CHANGES.md index 0b4f512f9b..4c2fd0251a 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -2,6 +2,12 @@ CHANGES - OpenPrinting CUPS =========================== +Changes in CUPS v2.4.13 (YYYY-MM-DD) +------------------------------------ + +- Fixed a memory leak in `httpClose` (Issue #1223) + + Changes in CUPS v2.4.12 (2025-04-08) ------------------------------------ @@ -15,7 +21,8 @@ Changes in CUPS v2.4.12 (2025-04-08) - Fixed a potential "lost PPD" condition in the scheduler (Issue #1109) - Fixed a compressed file error handling bug (Issue #1070) - Fixed a bug in the make-and-model whitespace trimming code (Issue #1096) -- Fixed a removal of IPP Everywhere permanent queue if installation failed (Issue #1102) +- Fixed a removal of IPP Everywhere permanent queue if installation failed + (Issue #1102) - Fixed `ServerToken None` in scheduler (Issue #1111) - Fixed invalid IPP keyword values created from PPD option names (Issue #1118) - Fixed handling of "media" and "PageSize" in the same print request diff --git a/cups/http.c b/cups/http.c index 31a8be3614..889760fd29 100644 --- a/cups/http.c +++ b/cups/http.c @@ -350,6 +350,7 @@ httpClearFields(http_t *http) /* I - HTTP connection */ void httpClose(http_t *http) /* I - HTTP connection */ { + http_field_t field; /* Current field */ #ifdef HAVE_GSSAPI OM_uint32 minor_status; /* Minor status code */ #endif /* HAVE_GSSAPI */ @@ -392,7 +393,12 @@ httpClose(http_t *http) /* I - HTTP connection */ AuthorizationFree(http->auth_ref, kAuthorizationFlagDefaults); #endif /* HAVE_AUTHORIZATION_H */ - httpClearFields(http); + for (field = HTTP_FIELD_ACCEPT_LANGUAGE; field < HTTP_FIELD_MAX; field ++) + { + free(http->default_fields[field]); + if (field >= HTTP_FIELD_ACCEPT_ENCODING || http->fields[field] != http->_fields[field]) + free(http->fields[field]); + } if (http->authstring && http->authstring != http->_authstring) free(http->authstring); -- 2.47.2