From 79c9b04b845a6e0e30e657c4d611a53babca3055 Mon Sep 17 00:00:00 2001 From: Emmanuel T Odeke Date: Sat, 7 Dec 2024 12:40:09 -0800 Subject: [PATCH] fix(contribs): close file in execBalancesExport (#3294) Ensures that the opened file is not leaked and closed after use. Fixes #3032 --- contribs/gnogenesis/internal/balances/balances_export.go | 1 + 1 file changed, 1 insertion(+) diff --git a/contribs/gnogenesis/internal/balances/balances_export.go b/contribs/gnogenesis/internal/balances/balances_export.go index df9d6795805..1970e348b1a 100644 --- a/contribs/gnogenesis/internal/balances/balances_export.go +++ b/contribs/gnogenesis/internal/balances/balances_export.go @@ -60,6 +60,7 @@ func execBalancesExport(cfg *balancesCfg, io commands.IO, args []string) error { if err != nil { return fmt.Errorf("unable to create output file, %w", err) } + defer outputFile.Close() // Save the balances for _, balance := range state.Balances {