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:19:42 UTC

git commit: updated refs/heads/4.4-forward to 67d9272

Repository: cloudstack
Updated Branches:
  refs/heads/4.4-forward 733301672 -> 67d92726c


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/67d92726
Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/67d92726
Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/67d92726

Branch: refs/heads/4.4-forward
Commit: 67d92726cb4b0b195804fb8a3e3c76f9a2341b39
Parents: 7333016
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:19:29 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/67d92726/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 b7b6bc4..46dc03f 100644
--- a/engine/schema/src/com/cloud/upgrade/dao/Upgrade430to440.java
+++ b/engine/schema/src/com/cloud/upgrade/dao/Upgrade430to440.java
@@ -253,14 +253,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);