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>
This commit is contained in:
parent
9fd0655adb
commit
004e0cbf61
|
|
@ -242,6 +242,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);
|
||||
|
|
@ -251,8 +254,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