summaryrefslogtreecommitdiff
path: root/src/diff_parse.c
diff options
context:
space:
mode:
authorPatrick Steinhardt <ps@pks.im>2017-04-25 09:48:59 +0200
committerPatrick Steinhardt <ps@pks.im>2017-04-25 09:51:49 +0200
commit1cb30b1bb45645a2f01ddc855a8644079215f931 (patch)
tree990d3ec9baf83bc529ac4de3fcbb0da329f6165f /src/diff_parse.c
parent0d2f6824ebf0bf9cb6c2bfb0ac9072d9dbb474c0 (diff)
downloadlibgit2-1cb30b1bb45645a2f01ddc855a8644079215f931.tar.gz
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.
Diffstat (limited to 'src/diff_parse.c')
-rw-r--r--src/diff_parse.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/diff_parse.c b/src/diff_parse.c
index 24a8a4af6..5e3a7a177 100644
--- a/src/diff_parse.c
+++ b/src/diff_parse.c
@@ -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;
}