Skip to content

Commit

Permalink
Shift the buf free nil check back to json encoder to better appease c…
Browse files Browse the repository at this point in the history
…ode coverage numbers
  • Loading branch information
Joshua T Corbin committed Jun 26, 2018
1 parent b4a606a commit 7ba34d3
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 1 addition & 3 deletions buffer/buffer.go
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,5 @@ func (b *Buffer) TrimNewline() {
//
// Callers must not retain references to the Buffer after calling Free.
func (b *Buffer) Free() {
if b != nil {
b.pool.put(b)
}
b.pool.put(b)
}
4 changes: 3 additions & 1 deletion zapcore/json_encoder.go
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,9 @@ func getJSONEncoder() *jsonEncoder {
}

func putJSONEncoder(enc *jsonEncoder) {
enc.reflectBuf.Free()
if enc.reflectBuf != nil {
enc.reflectBuf.Free()
}
enc.EncoderConfig = nil
enc.buf = nil
enc.spaced = false
Expand Down

0 comments on commit 7ba34d3

Please sign in to comment.