diff --git a/src/diff.c b/src/diff.c index 9bec1330..7f69c920 100644 --- a/src/diff.c +++ b/src/diff.c @@ -77,8 +77,8 @@ wrap_patch(git_patch *patch) delta = git_patch_get_delta(patch); - py_patch->old_file_path = delta->old_file.path; - py_patch->new_file_path = delta->new_file.path; + py_patch->old_file_path = strdup(delta->old_file.path); + py_patch->new_file_path = strdup(delta->new_file.path); py_patch->status = git_diff_status_char(delta->status); py_patch->similarity = delta->similarity; py_patch->flags = delta->flags; @@ -88,7 +88,6 @@ wrap_patch(git_patch *patch) git_patch_line_stats(NULL, &additions, &deletions, patch); py_patch->additions = additions; py_patch->deletions = deletions; - py_patch->patch = patch; hunk_amounts = git_patch_num_hunks(patch); py_patch->hunks = PyList_New(hunk_amounts); @@ -153,7 +152,8 @@ Patch_dealloc(Patch *self) Py_CLEAR(self->hunks); Py_CLEAR(self->old_id); Py_CLEAR(self->new_id); - git_patch_free(self->patch); + free(self->old_file_path); + free(self->new_file_path); PyObject_Del(self); } diff --git a/src/types.h b/src/types.h index f82667f3..78747cf2 100644 --- a/src/types.h +++ b/src/types.h @@ -112,7 +112,6 @@ typedef struct { unsigned additions; unsigned deletions; unsigned flags; - git_patch* patch; } Patch; typedef struct {