From: Michael R Sweet Date: Fri, 11 Apr 2025 13:51:00 +0000 (-0400) Subject: Fix memory leak in httpClose (Issue #1223) X-Git-Url: http://git.ipfire.org/gitweb/gitweb.cgi?a=commitdiff_plain;h=f50f36003f24a59b67627f5ce357ee667b85612a;p=thirdparty%2Fcups.git Fix memory leak in httpClose (Issue #1223) --- diff --git a/cups/http.c b/cups/http.c index dfefbacb80..613493ded1 100644 --- a/cups/http.c +++ b/cups/http.c @@ -294,6 +294,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 @@ -336,7 +337,12 @@ httpClose(http_t *http) // I - HTTP connection AuthorizationFree(http->auth_ref, kAuthorizationFlagDefaults); #endif // HAVE_AUTHORIZATION_H - httpClearFields(http); + for (field = HTTP_FIELD_ACCEPT; 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);