This is an automated email from the ASF dual-hosted git repository.

markt-asf pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/tomcat.git


The following commit(s) were added to refs/heads/main by this push:
     new 3e3f11a36c Only recycle the elements that were filtered out
3e3f11a36c is described below

commit 3e3f11a36c534663acaeab464baba2b3416355a2
Author: Mark Thomas <[email protected]>
AuthorDate: Wed Jun 3 10:39:52 2026 +0100

    Only recycle the elements that were filtered out
---
 java/org/apache/tomcat/util/http/MimeHeaders.java | 7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)

diff --git a/java/org/apache/tomcat/util/http/MimeHeaders.java 
b/java/org/apache/tomcat/util/http/MimeHeaders.java
index 5ead82705e..7b4ba0b58d 100644
--- a/java/org/apache/tomcat/util/http/MimeHeaders.java
+++ b/java/org/apache/tomcat/util/http/MimeHeaders.java
@@ -172,11 +172,10 @@ public class MimeHeaders {
                 }
             }
         }
+        int unfilteredCount = count;
         count = ++j;
-        for (int i = count; i < headers.length; i++) {
-            if (headers[i] != null) {
-                headers[i].recycle();
-            }
+        for (int i = count; i < unfilteredCount; i++) {
+            headers[i].recycle();
         }
     }
 


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to