Skip to content

diff: cleanup hash ctx in git_diff_patchid#4348

Merged
ethomson merged 1 commit into
libgit2:masterfrom
pks-t:pks/win32-hash-memleak
Sep 16, 2017
Merged

diff: cleanup hash ctx in git_diff_patchid#4348
ethomson merged 1 commit into
libgit2:masterfrom
pks-t:pks/win32-hash-memleak

Conversation

@pks-t

@pks-t pks-t commented Sep 15, 2017

Copy link
Copy Markdown
Member

After initializing the hash context in git_diff_patchid, we never
proceed to call git_hash_ctx_cleanup on it. While this doesn't really
matter on most hash implementations, this causes a memory leak on Win32
due to CNG system requiring a malloc call.

Fix the memory leak by always calling git_hash_ctx_cleanup before
exiting.

After initializing the hash context in `git_diff_patchid`, we never
proceed to call `git_hash_ctx_cleanup` on it. While this doesn't really
matter on most hash implementations, this causes a memory leak on Win32
due to CNG system requiring a `malloc` call.

Fix the memory leak by always calling `git_hash_ctx_cleanup` before
exiting.
@ethomson ethomson merged commit 212da30 into libgit2:master Sep 16, 2017
@ethomson

Copy link
Copy Markdown
Member

Good catch, thanks @pks-t, as always.

@pks-t pks-t deleted the pks/win32-hash-memleak branch November 11, 2017 20:36
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.

2 participants