Skip to content

Commit 94869ab

Browse files
authored
Merge pull request #368 from alextomaili/fix-memory-allocation-overhead
allocate string for error description only if it really required
2 parents 0039f4a + f71b909 commit 94869ab

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

reflect_struct_decoder.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -530,8 +530,8 @@ func (decoder *generalStructDecoder) decodeOneField(ptr unsafe.Pointer, iter *It
530530
}
531531
}
532532
if fieldDecoder == nil {
533-
msg := "found unknown field: " + field
534533
if decoder.disallowUnknownFields {
534+
msg := "found unknown field: " + field
535535
iter.ReportError("ReadObject", msg)
536536
}
537537
c := iter.nextToken()

0 commit comments

Comments
 (0)