Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix potential leak of HTTP response body in downloadJSON #618

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

marcusperlick
Copy link

  1. According to standard library the client must close the Body of http response. The function downloadJSON() in the csaf_aggregator defers the Body.Close() after some checks are made and an early return that may return even when c.Get() does not return an error. This is where the res.Body might not be closed.
  2. Besides that either I didn't get the idea behind the return via a call to a closure or it should be simplified.
  3. Do not drop the err details from c.Get() but give them more context. See Go Blog: It is the error implementation’s responsibility to summarize the context.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants