From 306e7e2c5eec9b0002dab5ec20956f4e09324051 Mon Sep 17 00:00:00 2001 From: emrekzd Date: Wed, 6 Aug 2014 12:07:04 -0700 Subject: [PATCH] bugfix: changed put function to store copy of Prefix slice --- patricia/patricia.go | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/patricia/patricia.go b/patricia/patricia.go index 8fcbcdf..a66e775 100644 --- a/patricia/patricia.go +++ b/patricia/patricia.go @@ -250,6 +250,11 @@ func (trie *Trie) put(key Prefix, item Item, replace bool) (inserted bool) { panic(ErrNilPrefix) } + // make a copy of the key slice + keyCp := make(Prefix, len(key)) + copy(keyCp, key) + key = keyCp + var ( common int node *Trie = trie