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 a leak during error handling in dir size calculation #324

Merged
merged 2 commits into from
Jan 15, 2021

Conversation

cottsay
Copy link
Member

@cottsay cottsay commented Jan 12, 2021

Have to free the memory allocated on line 357.

FYI @Barry-Xu-2018

  • Linux Build Status
  • Linux-aarch64 Build Status
  • macOS Build Status
  • Windows Build Status

Signed-off-by: Scott K Logan <logans@cottsay.net>
@cottsay cottsay added bug Something isn't working in review Waiting for review (Kanban column) labels Jan 12, 2021
@cottsay cottsay self-assigned this Jan 12, 2021
Copy link
Collaborator

@fujitatomoya fujitatomoya left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm

Signed-off-by: Scott K Logan <logans@cottsay.net>
@cottsay
Copy link
Member Author

cottsay commented Jan 12, 2021

The clang build on macOS pointed out that jumping to the error handling label leaves some rather ambiguous behavior regarding variables that are initialized later in the function. I updated this change to specifically free the allocated memory and return rather than jump to the label.

Alternatively, we could move the variable declarations and initializations earlier in the function, but due to the platform-specific #ifdefs, this would make the function harder to read.

@cottsay cottsay merged commit 70599c8 into master Jan 15, 2021
@delete-merged-branch delete-merged-branch bot deleted the cottsay/dir_size_leaks branch January 15, 2021 19:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working in review Waiting for review (Kanban column)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants