From d581dfee5fbd46f3e6c54e3fab2717105e6bd510 Mon Sep 17 00:00:00 2001
From: Felix Lange <fjl@twurst.com>
Date: Mon, 6 Jul 2015 01:19:16 +0200
Subject: [PATCH] ethdb: copy stored memdb values

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.
---
 ethdb/memory_database.go | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/ethdb/memory_database.go b/ethdb/memory_database.go
index 4fcce1812..fd5663fec 100644
--- a/ethdb/memory_database.go
+++ b/ethdb/memory_database.go
@@ -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
 }
 
-- 
GitLab