]> Cypherpunks repositories - gostls13.git/commitdiff
runtime: only clear key string's pointer in mapdelete_faststr
authorJosh Bleecher Snyder <josharian@gmail.com>
Sat, 26 Aug 2017 13:55:34 +0000 (06:55 -0700)
committerJosh Bleecher Snyder <josharian@gmail.com>
Mon, 28 Aug 2017 18:57:02 +0000 (18:57 +0000)
Change-Id: I0360d294868ec4423e4ae036009fac4e72425c9c
Reviewed-on: https://go-review.googlesource.com/59152
Run-TryBot: Josh Bleecher Snyder <josharian@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Keith Randall <khr@golang.org>
src/runtime/hashmap_fast.go

index c3786478925ac9b82365890fc7e5b27cc2056663..f117311439f553c1312d2fd8939b8bdbbee90b69 100644 (file)
@@ -754,7 +754,8 @@ search:
                        if k.str != key.str && !memequal(k.str, key.str, uintptr(key.len)) {
                                continue
                        }
-                       *(*string)(kptr) = ""
+                       // Clear key's pointer.
+                       k.str = nil
                        // Only clear value if there are pointers in it.
                        if t.elem.kind&kindNoPointers == 0 {
                                v := add(unsafe.Pointer(b), dataOffset+bucketCnt*2*sys.PtrSize+i*uintptr(t.valuesize))