You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cloudstack.apache.org by hu...@apache.org on 2014/06/03 09:22:15 UTC

git commit: updated refs/heads/4.4 to b941b18

Repository: cloudstack
Updated Branches:
  refs/heads/4.4 e249038ee -> b941b1882


Fixed ResouceLeak on pstmtCidr in the function Upgrade430to440.moveCidrsToTheirOwnTable as reported by coverity

Signed-off-by: Hugo Trippaers <ht...@schubergphilis.com>


Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo
Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/b941b188
Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/b941b188
Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/b941b188

Branch: refs/heads/4.4
Commit: b941b1882c039964d1f807cc3bc09af78415a004
Parents: e249038
Author: Rajani Karuturi <ra...@gmail.com>
Authored: Tue Jun 3 12:31:20 2014 +0530
Committer: Hugo Trippaers <ht...@schubergphilis.com>
Committed: Tue Jun 3 09:21:50 2014 +0200

----------------------------------------------------------------------
 .../schema/src/com/cloud/upgrade/dao/Upgrade430to440.java | 10 ++++------
 1 file changed, 4 insertions(+), 6 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/b941b188/engine/schema/src/com/cloud/upgrade/dao/Upgrade430to440.java
----------------------------------------------------------------------
diff --git a/engine/schema/src/com/cloud/upgrade/dao/Upgrade430to440.java b/engine/schema/src/com/cloud/upgrade/dao/Upgrade430to440.java
index 546c09c..12be30e 100644
--- a/engine/schema/src/com/cloud/upgrade/dao/Upgrade430to440.java
+++ b/engine/schema/src/com/cloud/upgrade/dao/Upgrade430to440.java
@@ -222,14 +222,12 @@ public class Upgrade430to440 implements DbUpgrade {
                 String[] cidrArray = cidrList.split(",");
                 // insert a record per cidr
                 String networkAclItemCidrSql = "INSERT INTO `cloud`.`network_acl_item_cidrs` (network_acl_item_id, cidr) VALUES (?,?)";
-                for(String cidr: cidrArray)
-                {
-                    pstmtCidr = conn.prepareStatement(networkAclItemCidrSql);
-                    pstmtCidr.setLong(1,itemId);
-                    pstmtCidr.setString(2,cidr);
+                pstmtCidr = conn.prepareStatement(networkAclItemCidrSql);
+                pstmtCidr.setLong(1, itemId);
+                for (String cidr : cidrArray) {
+                    pstmtCidr.setString(2, cidr);
                     pstmtCidr.executeUpdate();
                 }
-                pstmtCidr.close();
             }
         } catch (SQLException e) {
             throw new CloudRuntimeException("Exception while Moving network acl item cidrs to a row per cidr", e);