ethdb: return copied value from MemDatabase.Get (#14958)

This commit is contained in:
gary rong
2017-08-11 18:41:49 +08:00
committed by Felix Lange
parent 17ce0a37de
commit 73c5aba21f
2 changed files with 16 additions and 1 deletions

View File

@ -50,7 +50,7 @@ func (db *MemDatabase) Get(key []byte) ([]byte, error) {
defer db.lock.RUnlock()
if entry, ok := db.db[string(key)]; ok {
return entry, nil
return common.CopyBytes(entry), nil
}
return nil, errors.New("not found")
}