mirror of
https://github.com/AdguardTeam/AdGuardHome.git
synced 2025-04-02 15:33:36 +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
|
return nil
|
||||||
}
|
}
|
||||||
|
defer func() {
|
||||||
|
err = errors.WithDeferred(err, file.Close())
|
||||||
|
}()
|
||||||
|
|
||||||
dl := &dataLeases{}
|
dl := &dataLeases{}
|
||||||
err = json.NewDecoder(file).Decode(dl)
|
err = json.NewDecoder(file).Decode(dl)
|
||||||
|
|
|
@ -20,7 +20,7 @@ import (
|
||||||
var testdata = os.DirFS("testdata")
|
var testdata = os.DirFS("testdata")
|
||||||
|
|
||||||
// newTempDB copies the leases database file located in the testdata FS, under
|
// 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.
|
// copied file.
|
||||||
func newTempDB(tb testing.TB) (dst string) {
|
func newTempDB(tb testing.TB) (dst string) {
|
||||||
tb.Helper()
|
tb.Helper()
|
||||||
|
|
Loading…
Add table
Reference in a new issue