]> Cypherpunks repositories - gostls13.git/commit
net/http: fix minor leak in Header.WriteSubset
authorJoshua Rubin <joshua@rubixconsulting.com>
Fri, 27 Oct 2017 07:47:08 +0000 (01:47 -0600)
committerTom Bergan <tombergan@google.com>
Fri, 27 Oct 2017 19:33:14 +0000 (19:33 +0000)
commita4d03a9bf7604b727abd0a1ebfb118ff6366ee50
tree28954eb28da460c6cefaf5447dd31782b61adadc
parentb52b77cb953430b76242724394bb66e79fda9f10
net/http: fix minor leak in Header.WriteSubset

Header.WriteSubset uses a sync.Pool but wouldn't Put the sorter back in
the pool if there was an error writing to the io.Writer

I'm not really sure why the sorter is returned to begin with. The
comment says "for possible return to headerSorterCache".

This also doesn't address potential panics that might occur, but the
overhead of doing the Put in a defer would likely be too great.

Change-Id: If3c45a4c3e11f6ec65d187e25b63455b0142d4e3
Reviewed-on: https://go-review.googlesource.com/73910
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Tom Bergan <tombergan@google.com>
src/net/http/header.go