From 66b8cb792aea0df6ab90642b8595a8c3ee72ca64 Mon Sep 17 00:00:00 2001 From: Masaaki Goshima Date: Thu, 17 Sep 2020 21:48:39 +0900 Subject: [PATCH] Keep reference of interface value --- decode_map.go | 2 ++ 1 file changed, 2 insertions(+) diff --git a/decode_map.go b/decode_map.go index 4e32ec8..01bca0a 100644 --- a/decode_map.go +++ b/decode_map.go @@ -28,11 +28,13 @@ func mapassign(t *rtype, m unsafe.Pointer, key, val unsafe.Pointer) func (d *mapDecoder) setKey(buf []byte, cursor int64, key interface{}) (int64, error) { header := (*interfaceHeader)(unsafe.Pointer(&key)) + d.dummy = header return d.keyDecoder.decode(buf, cursor, uintptr(header.ptr)) } func (d *mapDecoder) setValue(buf []byte, cursor int64, key interface{}) (int64, error) { header := (*interfaceHeader)(unsafe.Pointer(&key)) + d.dummy = header return d.valueDecoder.decode(buf, cursor, uintptr(header.ptr)) }