Commit fc6befba authored by Russ Cox's avatar Russ Cox

runtime: initialize complete Hiter during mapiterinit

The garbage collector will scan these pointers,
so make sure they are initialized.

LGTM=bradfitz, khr
R=khr, bradfitz
CC=golang-codereviews
https://golang.org/cl/80960047
parent a4380927
...@@ -1004,6 +1004,14 @@ func reflect·mapdelete(t *MapType, h *Hmap, key *byte) { ...@@ -1004,6 +1004,14 @@ func reflect·mapdelete(t *MapType, h *Hmap, key *byte) {
#pragma textflag NOSPLIT #pragma textflag NOSPLIT
func mapiterinit(t *MapType, h *Hmap, it *Hiter) { func mapiterinit(t *MapType, h *Hmap, it *Hiter) {
// Clear pointer fields so garbage collector does not complain.
it->key = nil;
it->value = nil;
it->t = nil;
it->h = nil;
it->buckets = nil;
it->bptr = nil;
if(h == nil || h->count == 0) { if(h == nil || h->count == 0) {
it->key = nil; it->key = nil;
return; return;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment