Browse Source

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" <francis.andre@e-xmlmedia.fr>


git-svn-id: https://svn.apache.org/repos/asf/ant/core/trunk@273571 13f79535-47bb-0310-9956-ffa450edef68
master
Magesh Umasankar 22 years ago
parent
commit
dba647572b
1 changed files with 7 additions and 0 deletions
  1. +7
    -0
      src/main/org/apache/tools/ant/types/selectors/SelectorUtils.java

+ 7
- 0
src/main/org/apache/tools/ant/types/selectors/SelectorUtils.java View File

@@ -227,6 +227,7 @@ public final class SelectorUtils {
} }
if (!match(patDir,(String)strDirs.elementAt(strIdxStart), if (!match(patDir,(String)strDirs.elementAt(strIdxStart),
isCaseSensitive)) { isCaseSensitive)) {
patDirs = null; strDirs = null;
return false; return false;
} }
patIdxStart++; patIdxStart++;
@@ -236,6 +237,7 @@ public final class SelectorUtils {
// String is exhausted // String is exhausted
for (int i = patIdxStart; i <= patIdxEnd; i++) { for (int i = patIdxStart; i <= patIdxEnd; i++) {
if (!patDirs.elementAt(i).equals("**")) { if (!patDirs.elementAt(i).equals("**")) {
patDirs = null; strDirs = null;
return false; return false;
} }
} }
@@ -243,6 +245,7 @@ public final class SelectorUtils {
} else { } else {
if (patIdxStart > patIdxEnd) { if (patIdxStart > patIdxEnd) {
// String not exhausted, but pattern is. Failure. // String not exhausted, but pattern is. Failure.
patDirs = null; strDirs = null;
return false; return false;
} }
} }
@@ -255,6 +258,7 @@ public final class SelectorUtils {
} }
if (!match(patDir,(String)strDirs.elementAt(strIdxEnd), if (!match(patDir,(String)strDirs.elementAt(strIdxEnd),
isCaseSensitive)) { isCaseSensitive)) {
patDirs = null; strDirs = null;
return false; return false;
} }
patIdxEnd--; patIdxEnd--;
@@ -264,6 +268,7 @@ public final class SelectorUtils {
// String is exhausted // String is exhausted
for (int i = patIdxStart; i <= patIdxEnd; i++) { for (int i = patIdxStart; i <= patIdxEnd; i++) {
if (!patDirs.elementAt(i).equals("**")) { if (!patDirs.elementAt(i).equals("**")) {
patDirs = null; strDirs = null;
return false; return false;
} }
} }
@@ -303,6 +308,7 @@ strLoop:
} }


if (foundIdx == -1) { if (foundIdx == -1) {
patDirs = null; strDirs = null;
return false; return false;
} }


@@ -312,6 +318,7 @@ strLoop:


for (int i = patIdxStart; i <= patIdxEnd; i++) { for (int i = patIdxStart; i <= patIdxEnd; i++) {
if (!patDirs.elementAt(i).equals("**")) { if (!patDirs.elementAt(i).equals("**")) {
patDirs = null; strDirs = null;
return false; return false;
} }
} }


Loading…
Cancel
Save