From c99d18fc27f122c15955fbdae507224d8454543f Mon Sep 17 00:00:00 2001 From: Christopher Tarry Date: Mon, 3 Jun 2024 10:16:25 -0400 Subject: [PATCH] close two prepared statements that aren't being closed --- persist/sqlite/consensus.go | 2 ++ 1 file changed, 2 insertions(+) diff --git a/persist/sqlite/consensus.go b/persist/sqlite/consensus.go index b4c83beb..def11692 100644 --- a/persist/sqlite/consensus.go +++ b/persist/sqlite/consensus.go @@ -269,6 +269,7 @@ func addTransactions(tx *txn, bid types.BlockID, txns []types.Transaction, scDBI if err != nil { return nil, fmt.Errorf("failed to prepare check transaction statement: %v", err) } + defer checkTransactionStmt.Close() insertTransactionStmt, err := tx.Prepare(`INSERT INTO transactions (transaction_id) VALUES (?)`) if err != nil { @@ -747,6 +748,7 @@ func addFileContractElements(tx *txn, b types.Block, fces []explorer.FileContrac if err != nil { return nil, fmt.Errorf("addFileContractElements: failed to prepare last_contract_revision statement: %w", err) } + defer revisionStmt.Close() fcDBIds := make(map[explorer.DBFileContract]int64) addFC := func(fcID types.FileContractID, leafIndex uint64, fc types.FileContract, resolved, valid, lastRevision bool) error {