Skip to content

Commit

Permalink
Ensure RUnlock() called directly after read to prevent deadlock withi…
Browse files Browse the repository at this point in the history
…n registerValue()
  • Loading branch information
mattevans committed May 16, 2017
1 parent 72cedcc commit 78b9927
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions changes/mapper.go
Original file line number Diff line number Diff line change
Expand Up @@ -47,10 +47,10 @@ func NewTagMapper(tags ...string) *TagMapper {
// locations in the value's type.
func (mapper *TagMapper) KeyIndexes(value reflect.Value) (KeyIndexes, error) {
mapper.RLock()
defer mapper.RUnlock()

typ := value.Type()
if indexes, ok := mapper.types[typ]; ok {
indexes, ok := mapper.types[typ]
mapper.RUnlock()
if ok {
return indexes, nil
}
return mapper.registerValue(value)
Expand Down

0 comments on commit 78b9927

Please sign in to comment.