dhcpsvc: close db
This commit is contained in:
parent
d08b70983d
commit
064d4aa30b
|
@ -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 New Issue