Skip to content

Commit

Permalink
ethdb: copy stored memdb values
Browse files Browse the repository at this point in the history
Storing a value in LevelDB copies the bytes, modifying the value
afterwards does not affect the content of the database. This commit
ensures that MemDatabase satisfies the same property.
  • Loading branch information
fjl committed Sep 14, 2015
1 parent 8b32f10 commit d581dfe
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions ethdb/memory_database.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,7 @@ func NewMemDatabase() (*MemDatabase, error) {
}

func (db *MemDatabase) Put(key []byte, value []byte) error {
db.db[string(key)] = value

db.db[string(key)] = common.CopyBytes(value)
return nil
}

Expand Down

0 comments on commit d581dfe

Please sign in to comment.