Skip to content

Commit 1cb30b1

Browse files
committed
diff_parse: free object instead of its pointer
In e733001 (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.
1 parent 0d2f682 commit 1cb30b1

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/diff_parse.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ static git_diff_parsed *diff_parsed_alloc(void)
4545
diff->base.free_fn = diff_parsed_free;
4646

4747
if (git_diff_init_options(&diff->base.opts, GIT_DIFF_OPTIONS_VERSION) < 0) {
48-
git__free(&diff);
48+
git__free(diff);
4949
return NULL;
5050
}
5151

0 commit comments

Comments
 (0)