mirror of
https://github.com/apache/cloudstack.git
synced 2025-11-02 20:02:29 +01:00
coverity 1116562: resource count resource leak
This commit is contained in:
parent
49cb56bbca
commit
168199360d
@ -280,14 +280,13 @@ public class Upgrade420to421 implements DbUpgrade {
|
||||
|
||||
private static void upgradeResourceCountforDomain(Connection conn, Long domainId, String type, Long resourceCount) throws SQLException {
|
||||
//update or insert into resource_count table.
|
||||
PreparedStatement pstmt = null;
|
||||
pstmt =
|
||||
conn.prepareStatement("INSERT INTO `cloud`.`resource_count` (domain_id, type, count) VALUES (?,?,?) ON DUPLICATE KEY UPDATE id=LAST_INSERT_ID(id), count=?");
|
||||
pstmt.setLong(1, domainId);
|
||||
pstmt.setString(2, type);
|
||||
pstmt.setLong(3, resourceCount);
|
||||
pstmt.setLong(4, resourceCount);
|
||||
pstmt.executeUpdate();
|
||||
pstmt.close();
|
||||
String sqlInsertResourceCount = "INSERT INTO `cloud`.`resource_count` (domain_id, type, count) VALUES (?,?,?) ON DUPLICATE KEY UPDATE id=LAST_INSERT_ID(id), count=?";
|
||||
try (PreparedStatement pstmt = conn.prepareStatement(sqlInsertResourceCount);) {
|
||||
pstmt.setLong(1, domainId);
|
||||
pstmt.setString(2, type);
|
||||
pstmt.setLong(3, resourceCount);
|
||||
pstmt.setLong(4, resourceCount);
|
||||
pstmt.executeUpdate();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user