mirror of
https://git.proxmox.com/git/libgit2
synced 2025-08-03 03:44:21 +00:00
diff_parse: free object instead of its pointer
In e7330016a
(diff_parse: check return value of `git_diff_init_options`,
2017-03-20), we've introduced an error check whether we're able to
correctly initialize the diff options. This simple commit actually
introduced a segfault in that we now try to free the pointer to the
allocated diff in an error case, instead of the allocated diff itself.
This commit fixes the issue.
This commit is contained in:
parent
0d2f6824eb
commit
1cb30b1bb4
@ -45,7 +45,7 @@ static git_diff_parsed *diff_parsed_alloc(void)
|
||||
diff->base.free_fn = diff_parsed_free;
|
||||
|
||||
if (git_diff_init_options(&diff->base.opts, GIT_DIFF_OPTIONS_VERSION) < 0) {
|
||||
git__free(&diff);
|
||||
git__free(diff);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user