Commit Graph

5 Commits

Author SHA1 Message Date
Patrick Steinhardt
1cb30b1bb4 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.
2017-04-25 09:51:49 +02:00
Patrick Steinhardt
e7330016af diff_parse: check return value of git_diff_init_options 2017-03-21 15:48:16 +01:00
Patrick Steinhardt
c0eba379d1 diff_parse: correctly set options for parsed diffs
The function `diff_parsed_alloc` allocates and initializes a
`git_diff_parsed` structure. This structure also contains diff options.
While we initialize its flags, we fail to do a real initialization of
its values. This bites us when we want to actually use the generated
diff as we do not se the option's version field, which is required to
operate correctly.

Fix the issue by executing `git_diff_init_options` on the embedded
struct.
2017-03-14 13:09:35 +01:00
Edward Thomson
b859faa61c Teach git_patch_from_diff about parsed diffs
Ensure that `git_patch_from_diff` can return the patch for parsed diffs,
not just generate a patch for a generated diff.
2016-08-24 09:08:57 -05:00
Edward Thomson
7166bb1665 introduce git_diff_from_buffer to parse diffs
Parse diff files into a `git_diff` structure.
2016-05-26 13:01:09 -05:00