diff options
author | Přemysl Eric Janouch <p@janouch.name> | 2020-10-10 14:18:22 +0200 |
---|---|---|
committer | Přemysl Eric Janouch <p@janouch.name> | 2020-10-10 14:18:22 +0200 |
commit | 93b29a534689cc171de0ca917c982d2f76496633 (patch) | |
tree | 4d0f229a47882bb54e1ccf46beb446f99e409c8a | |
parent | 696ea8953089c3872bca22ec24ca28139ef46cd3 (diff) | |
download | sklad-93b29a534689cc171de0ca917c982d2f76496633.tar.gz sklad-93b29a534689cc171de0ca917c982d2f76496633.tar.xz sklad-93b29a534689cc171de0ca917c982d2f76496633.zip |
sklad: close the DB FD once finished reading
Fixes a resource leak.
-rw-r--r-- | cmd/sklad/db.go | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/cmd/sklad/db.go b/cmd/sklad/db.go index fc79f0f..3def2e5 100644 --- a/cmd/sklad/db.go +++ b/cmd/sklad/db.go @@ -298,6 +298,7 @@ func loadDatabase() error { if err != nil { return err } + defer dbFile.Close() if err := json.NewDecoder(dbFile).Decode(&db); err != nil { return err } |