Skip to content

Commit

Permalink
Merge pull request #680 from cj123/stracker-mem-leak
Browse files Browse the repository at this point in the history
fixes a memory leak when proxying stracker pages
  • Loading branch information
cj123 authored Dec 16, 2019
2 parents 3e567e7 + c1aeb1e commit 72868d6
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 0 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ Fixes:

* Fixed an issue with filtering from results files in Race Weekends when the Race Weekend is within a Championship.
* We've changed the method that we use to check if scheduled events need running. Hopefully this should make scheduled events more reliable!
* Fixes a memory leak when proxying STracker pages

---

Expand Down
4 changes: 4 additions & 0 deletions stracker.go
Original file line number Diff line number Diff line change
Expand Up @@ -374,6 +374,10 @@ func (sth *StrackerHandler) proxy(w http.ResponseWriter, r *http.Request) {
return err
}

if err := r.Body.Close(); err != nil {
return err
}

r.Body = ioutil.NopCloser(buf)
r.Header.Set("Content-Length", fmt.Sprint(buf.Len()))

Expand Down

0 comments on commit 72868d6

Please sign in to comment.