[libpostgresql-jdbc-java] 52/93: Fix a couple of trivial Statement leaks.

Emmanuel Bourg ebourg-guest at moszumanska.debian.org
Mon Jan 9 10:18:51 UTC 2017


This is an automated email from the git hooks/post-receive script.

ebourg-guest pushed a commit to annotated tag REL9_3_1102
in repository libpostgresql-jdbc-java.

commit 095598c913d36bd04b0e585f95236b3f7447c2b8
Author: Heikki Linnakangas <heikki.linnakangas at iki.fi>
Date:   Wed Nov 13 22:20:26 2013 +0200

    Fix a couple of trivial Statement leaks.
    
    Found by Coverity.
---
 org/postgresql/jdbc2/AbstractJdbc2ResultSetMetaData.java | 1 +
 org/postgresql/jdbc3/AbstractJdbc3Connection.java        | 4 +++-
 2 files changed, 4 insertions(+), 1 deletion(-)

diff --git a/org/postgresql/jdbc2/AbstractJdbc2ResultSetMetaData.java b/org/postgresql/jdbc2/AbstractJdbc2ResultSetMetaData.java
index 84a08a3..3f84c41 100644
--- a/org/postgresql/jdbc2/AbstractJdbc2ResultSetMetaData.java
+++ b/org/postgresql/jdbc2/AbstractJdbc2ResultSetMetaData.java
@@ -253,6 +253,7 @@ public abstract class AbstractJdbc2ResultSetMetaData implements PGResultSetMetaD
                 }
             }
         }
+	stmt.close();
     }
 
     public String getBaseSchemaName(int column) throws SQLException
diff --git a/org/postgresql/jdbc3/AbstractJdbc3Connection.java b/org/postgresql/jdbc3/AbstractJdbc3Connection.java
index c7738a0..3131a64 100644
--- a/org/postgresql/jdbc3/AbstractJdbc3Connection.java
+++ b/org/postgresql/jdbc3/AbstractJdbc3Connection.java
@@ -93,6 +93,7 @@ public abstract class AbstractJdbc3Connection extends org.postgresql.jdbc2.Abstr
      */
     public Savepoint setSavepoint() throws SQLException
     {
+	String pgName;
         checkClosed();
         if (!haveMinimumServerVersion("8.0"))
             throw new PSQLException(GT.tr("Server versions prior to 8.0 do not support savepoints."), PSQLState.NOT_IMPLEMENTED);
@@ -101,11 +102,12 @@ public abstract class AbstractJdbc3Connection extends org.postgresql.jdbc2.Abstr
                                     PSQLState.NO_ACTIVE_SQL_TRANSACTION);
 
         PSQLSavepoint savepoint = new PSQLSavepoint(savepointId++);
+	pgName = savepoint.getPGName();
 
         // Note we can't use execSQLUpdate because we don't want
         // to suppress BEGIN.
         Statement stmt = createStatement();
-        stmt.executeUpdate("SAVEPOINT " + savepoint.getPGName());
+        stmt.executeUpdate("SAVEPOINT " + pgName);
         stmt.close();
 
         return savepoint;

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-java/libpostgresql-jdbc-java.git



More information about the pkg-java-commits mailing list