This is an automated email from the ASF dual-hosted git repository.
markt pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/tomcat.git
The following commit(s) were added to refs/heads/master by this push:
new e4b431e Fix resource leak on exception path.
e4b431e is described below
commit e4b431e7080ac19774320067d89846b6dbaa63f4
Author: Mark Thomas <[email protected]>
AuthorDate: Wed Apr 17 17:23:30 2019 +0100
Fix resource leak on exception path.
Identified by Coverity scan.
---
java/org/apache/jasper/compiler/JspUtil.java | 13 +++++++++++--
webapps/docs/changelog.xml | 4 ++++
2 files changed, 15 insertions(+), 2 deletions(-)
diff --git a/java/org/apache/jasper/compiler/JspUtil.java
b/java/org/apache/jasper/compiler/JspUtil.java
index 11a6f18..d5dc2c7 100644
--- a/java/org/apache/jasper/compiler/JspUtil.java
+++ b/java/org/apache/jasper/compiler/JspUtil.java
@@ -891,8 +891,17 @@ public class JspUtil {
InputStreamReader reader = null;
InputStream in = getInputStream(fname, jar, ctxt);
- for (int i = 0; i < skip; i++) {
- in.read();
+ try {
+ for (int i = 0; i < skip; i++) {
+ in.read();
+ }
+ } catch (IOException ioe) {
+ try {
+ in.close();
+ } catch (IOException e) {
+ // Ignore
+ }
+ throw ioe;
}
try {
reader = new InputStreamReader(in, encoding);
diff --git a/webapps/docs/changelog.xml b/webapps/docs/changelog.xml
index c12e5a3..8de445d 100644
--- a/webapps/docs/changelog.xml
+++ b/webapps/docs/changelog.xml
@@ -72,6 +72,10 @@
Fix a potential resource leak on some exception paths in the
<code>DataSourceRealm</code>. Identified by Coverity scan. (markt)
</fix>
+ <fix>
+ Fix a potential resource leak on an exception path when parsing JSP
+ files. Identified by Coverity scan. (markt)
+ </fix>
</changelog>
</subsection>
<subsection name="Coyote">
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]