mirror of
https://github.com/AdguardTeam/AdGuardHome.git
synced 2024-11-24 05:55:43 +03:00
dhcpsvc: close db
This commit is contained in:
parent
d08b70983d
commit
064d4aa30b
2 changed files with 4 additions and 1 deletions
|
@ -106,6 +106,9 @@ func (srv *DHCPServer) dbLoad(ctx context.Context) (err error) {
|
|||
|
||||
return nil
|
||||
}
|
||||
defer func() {
|
||||
err = errors.WithDeferred(err, file.Close())
|
||||
}()
|
||||
|
||||
dl := &dataLeases{}
|
||||
err = json.NewDecoder(file).Decode(dl)
|
||||
|
|
|
@ -20,7 +20,7 @@ import (
|
|||
var testdata = os.DirFS("testdata")
|
||||
|
||||
// newTempDB copies the leases database file located in the testdata FS, under
|
||||
// tb.Name()/leases.db, to a temporary directory and returns the path to the
|
||||
// tb.Name()/leases.json, to a temporary directory and returns the path to the
|
||||
// copied file.
|
||||
func newTempDB(tb testing.TB) (dst string) {
|
||||
tb.Helper()
|
||||
|
|
Loading…
Reference in a new issue