Close snapshot and iterator when creating ledis dump (#245)

This commit is contained in:
divolgin 2016-07-14 17:49:07 -07:00 committed by siddontang
parent ca344836ab
commit 3a2cbda7f2
1 changed files with 2 additions and 0 deletions

View File

@ -60,6 +60,7 @@ func (l *Ledis) Dump(w io.Writer) error {
l.wLock.Unlock() l.wLock.Unlock()
return err return err
} }
defer snap.Close()
l.wLock.Unlock() l.wLock.Unlock()
@ -72,6 +73,7 @@ func (l *Ledis) Dump(w io.Writer) error {
} }
it := snap.NewIterator() it := snap.NewIterator()
defer it.Close()
it.SeekToFirst() it.SeekToFirst()
compressBuf := make([]byte, 4096) compressBuf := make([]byte, 4096)