tomcat-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From schu...@apache.org
Subject svn commit: r1725851 - /tomcat/trunk/java/org/apache/catalina/realm/DataSourceRealm.java
Date Thu, 21 Jan 2016 01:46:11 GMT
Author: schultz
Date: Thu Jan 21 01:46:11 2016
New Revision: 1725851

URL: http://svn.apache.org/viewvc?rev=1725851&view=rev
Log:
Fix potential resource leak.

Modified:
    tomcat/trunk/java/org/apache/catalina/realm/DataSourceRealm.java

Modified: tomcat/trunk/java/org/apache/catalina/realm/DataSourceRealm.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/catalina/realm/DataSourceRealm.java?rev=1725851&r1=1725850&r2=1725851&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/catalina/realm/DataSourceRealm.java (original)
+++ tomcat/trunk/java/org/apache/catalina/realm/DataSourceRealm.java Thu Jan 21 01:46:11 2016
@@ -258,12 +258,15 @@ public class DataSourceRealm extends Rea
             return null;
         }
 
-        // Acquire a Principal object for this user
-        Principal principal = authenticate(dbConnection, username, credentials);
-
-        close(dbConnection);
-
-        return principal;
+        try
+        {
+            // Acquire a Principal object for this user
+            return authenticate(dbConnection, username, credentials);
+        }
+        finally
+        {
+            close(dbConnection);
+        }
     }
 
 



---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org


Mime
View raw message