Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Ensure failed request buffers are cleaned up
When using `NewBufferedReadCloser`, it's normally the client's responsibility to `Close()` the returned buffer. However, if there's an error when initially populating the buffer, we don't return the failed buffer to the client, and we weren't closing it ourselves. This leads to stale buffers being left behind. Instead, if we can't return a properly populated buffer, we should close and discard it before returning nil.
- Loading branch information