Skip to content

Commit 5910c99

Browse files
committed
Fix memory leak in httpClose (Issue #1223)
1 parent 0b0425d commit 5910c99

2 files changed

Lines changed: 15 additions & 2 deletions

File tree

CHANGES.md

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,12 @@ CHANGES - OpenPrinting CUPS
22
===========================
33

44

5+
Changes in CUPS v2.4.13 (YYYY-MM-DD)
6+
------------------------------------
7+
8+
- Fixed a memory leak in `httpClose` (Issue #1223)
9+
10+
511
Changes in CUPS v2.4.12 (2025-04-08)
612
------------------------------------
713

@@ -15,7 +21,8 @@ Changes in CUPS v2.4.12 (2025-04-08)
1521
- Fixed a potential "lost PPD" condition in the scheduler (Issue #1109)
1622
- Fixed a compressed file error handling bug (Issue #1070)
1723
- Fixed a bug in the make-and-model whitespace trimming code (Issue #1096)
18-
- Fixed a removal of IPP Everywhere permanent queue if installation failed (Issue #1102)
24+
- Fixed a removal of IPP Everywhere permanent queue if installation failed
25+
(Issue #1102)
1926
- Fixed `ServerToken None` in scheduler (Issue #1111)
2027
- Fixed invalid IPP keyword values created from PPD option names (Issue #1118)
2128
- Fixed handling of "media" and "PageSize" in the same print request

cups/http.c

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -350,6 +350,7 @@ httpClearFields(http_t *http) /* I - HTTP connection */
350350
void
351351
httpClose(http_t *http) /* I - HTTP connection */
352352
{
353+
http_field_t field; /* Current field */
353354
#ifdef HAVE_GSSAPI
354355
OM_uint32 minor_status; /* Minor status code */
355356
#endif /* HAVE_GSSAPI */
@@ -392,7 +393,12 @@ httpClose(http_t *http) /* I - HTTP connection */
392393
AuthorizationFree(http->auth_ref, kAuthorizationFlagDefaults);
393394
#endif /* HAVE_AUTHORIZATION_H */
394395

395-
httpClearFields(http);
396+
for (field = HTTP_FIELD_ACCEPT_LANGUAGE; field < HTTP_FIELD_MAX; field ++)
397+
{
398+
free(http->default_fields[field]);
399+
if (field >= HTTP_FIELD_ACCEPT_ENCODING || http->fields[field] != http->_fields[field])
400+
free(http->fields[field]);
401+
}
396402

397403
if (http->authstring && http->authstring != http->_authstring)
398404
free(http->authstring);

0 commit comments

Comments
 (0)