mirror of https://github.com/apache/cloudstack.git
Fixed ResouceLeak on pstmtCidr in the function Upgrade430to440.moveCidrsToTheirOwnTable as reported by coverity
Fixed another leak which might occur due to outer while loop. Signed-off-by: Daan Hoogland <daan@onecht.net> (cherry picked from commit004e0cbf61) (cherry picked from commitfa3bbe9a19)
This commit is contained in:
parent
d511847cfe
commit
bd5cd69517
|
|
@ -243,6 +243,9 @@ public class Upgrade430to440 implements DbUpgrade {
|
|||
pstmtItem = conn.prepareStatement(networkAclItemSql);
|
||||
rsItems = pstmtItem.executeQuery();
|
||||
|
||||
String networkAclItemCidrSql = "INSERT INTO `cloud`.`network_acl_item_cidrs` (network_acl_item_id, cidr) VALUES (?,?)";
|
||||
pstmtCidr = conn.prepareStatement(networkAclItemCidrSql);
|
||||
|
||||
// for each network acl item
|
||||
while(rsItems.next()) {
|
||||
long itemId = rsItems.getLong(1);
|
||||
|
|
@ -252,8 +255,6 @@ public class Upgrade430to440 implements DbUpgrade {
|
|||
// split it
|
||||
String[] cidrArray = cidrList.split(",");
|
||||
// insert a record per cidr
|
||||
String networkAclItemCidrSql = "INSERT INTO `cloud`.`network_acl_item_cidrs` (network_acl_item_id, cidr) VALUES (?,?)";
|
||||
pstmtCidr = conn.prepareStatement(networkAclItemCidrSql);
|
||||
pstmtCidr.setLong(1, itemId);
|
||||
for (String cidr : cidrArray) {
|
||||
pstmtCidr.setString(2, cidr);
|
||||
|
|
|
|||
Loading…
Reference in New Issue