From dba647572b6c00d5971f75fc13ca4d0912c97b3c Mon Sep 17 00:00:00 2001 From: Magesh Umasankar Date: Thu, 21 Nov 2002 22:00:29 +0000 Subject: [PATCH] Patch that fix memory leaks in SelectorUtils.java The method matchPatternStart generates memory leaks due to the 2 Vectors: patDirs and strDirs, used to hold tokenizedPaths. Submitted by: "Francis ANDRE" git-svn-id: https://svn.apache.org/repos/asf/ant/core/trunk@273571 13f79535-47bb-0310-9956-ffa450edef68 --- .../apache/tools/ant/types/selectors/SelectorUtils.java | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/main/org/apache/tools/ant/types/selectors/SelectorUtils.java b/src/main/org/apache/tools/ant/types/selectors/SelectorUtils.java index 73d26b7f4..1968fb961 100644 --- a/src/main/org/apache/tools/ant/types/selectors/SelectorUtils.java +++ b/src/main/org/apache/tools/ant/types/selectors/SelectorUtils.java @@ -227,6 +227,7 @@ public final class SelectorUtils { } if (!match(patDir,(String)strDirs.elementAt(strIdxStart), isCaseSensitive)) { + patDirs = null; strDirs = null; return false; } patIdxStart++; @@ -236,6 +237,7 @@ public final class SelectorUtils { // String is exhausted for (int i = patIdxStart; i <= patIdxEnd; i++) { if (!patDirs.elementAt(i).equals("**")) { + patDirs = null; strDirs = null; return false; } } @@ -243,6 +245,7 @@ public final class SelectorUtils { } else { if (patIdxStart > patIdxEnd) { // String not exhausted, but pattern is. Failure. + patDirs = null; strDirs = null; return false; } } @@ -255,6 +258,7 @@ public final class SelectorUtils { } if (!match(patDir,(String)strDirs.elementAt(strIdxEnd), isCaseSensitive)) { + patDirs = null; strDirs = null; return false; } patIdxEnd--; @@ -264,6 +268,7 @@ public final class SelectorUtils { // String is exhausted for (int i = patIdxStart; i <= patIdxEnd; i++) { if (!patDirs.elementAt(i).equals("**")) { + patDirs = null; strDirs = null; return false; } } @@ -303,6 +308,7 @@ strLoop: } if (foundIdx == -1) { + patDirs = null; strDirs = null; return false; } @@ -312,6 +318,7 @@ strLoop: for (int i = patIdxStart; i <= patIdxEnd; i++) { if (!patDirs.elementAt(i).equals("**")) { + patDirs = null; strDirs = null; return false; } }