Skip to content

Conversation

@jkennedyvz
Copy link
Contributor

If os.Open fails, f is nil and the deferred f.Close() would panic. Move the defer after the error check so it only runs when f is valid.

Addresses: F-13 (CWE-476)

I confirm that this contribution is made under the terms of the license found in the root directory of this repository's source tree and that I have the authority necessary to make this contribution on behalf of its copyright owner.

If os.Open fails, f is nil and the deferred f.Close() would panic.
Move the defer after the error check so it only runs when f is valid.

Addresses: F-13 (CWE-476)
@jkennedyvz jkennedyvz requested a review from jrozner as a code owner February 9, 2026 07:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant