fix: avoid crash copy map before reading (#8825)
code of this form is always racy, when the map itself is being written to as well ``` func (r Map) retMap() map[string]string { .. lock .. return r.internalMap } func (r Map) addMap(k, v string) { .. lock .. r.internalMap[k] = v } ``` Anyone reading from `retMap()` is not protected because of locking and we need to make sure to avoid code in this manner. Always safe to copy the map and return.master
parent
080e0c2323
commit
b1ad99edbf
Loading…
Reference in new issue