Check errors returned by git_signature_dup
This commit is contained in:
23
src/blame.c
23
src/blame.c
@@ -60,19 +60,26 @@ PyObject*
|
|||||||
wrap_blame_hunk(const git_blame_hunk *hunk, Blame *blame)
|
wrap_blame_hunk(const git_blame_hunk *hunk, Blame *blame)
|
||||||
{
|
{
|
||||||
BlameHunk *py_hunk = NULL;
|
BlameHunk *py_hunk = NULL;
|
||||||
|
int err;
|
||||||
|
|
||||||
if (!hunk)
|
if (!hunk)
|
||||||
Py_RETURN_NONE;
|
Py_RETURN_NONE;
|
||||||
|
|
||||||
py_hunk = PyObject_New(BlameHunk, &BlameHunkType);
|
py_hunk = PyObject_New(BlameHunk, &BlameHunkType);
|
||||||
if (py_hunk != NULL) {
|
if (py_hunk == NULL)
|
||||||
|
return NULL;
|
||||||
|
|
||||||
py_hunk->lines_in_hunk = hunk->lines_in_hunk;
|
py_hunk->lines_in_hunk = hunk->lines_in_hunk;
|
||||||
py_hunk->final_commit_id = git_oid_allocfmt(&hunk->final_commit_id);
|
py_hunk->final_commit_id = git_oid_allocfmt(&hunk->final_commit_id);
|
||||||
py_hunk->final_start_line_number = hunk->final_start_line_number;
|
py_hunk->final_start_line_number = hunk->final_start_line_number;
|
||||||
|
|
||||||
py_hunk->final_signature = NULL;
|
py_hunk->final_signature = NULL;
|
||||||
if (hunk->final_signature)
|
if (hunk->final_signature) {
|
||||||
git_signature_dup(&py_hunk->final_signature, hunk->final_signature);
|
err = git_signature_dup(&py_hunk->final_signature,
|
||||||
|
hunk->final_signature);
|
||||||
|
if (err < 0)
|
||||||
|
return Error_set(err);
|
||||||
|
}
|
||||||
|
|
||||||
py_hunk->orig_commit_id = git_oid_allocfmt(&hunk->orig_commit_id);
|
py_hunk->orig_commit_id = git_oid_allocfmt(&hunk->orig_commit_id);
|
||||||
py_hunk->orig_path = hunk->orig_path != NULL ?
|
py_hunk->orig_path = hunk->orig_path != NULL ?
|
||||||
@@ -80,12 +87,14 @@ wrap_blame_hunk(const git_blame_hunk *hunk, Blame *blame)
|
|||||||
py_hunk->orig_start_line_number = hunk->orig_start_line_number;
|
py_hunk->orig_start_line_number = hunk->orig_start_line_number;
|
||||||
|
|
||||||
py_hunk->orig_signature = NULL;
|
py_hunk->orig_signature = NULL;
|
||||||
if (hunk->orig_signature)
|
if (hunk->orig_signature) {
|
||||||
git_signature_dup(&py_hunk->orig_signature, hunk->orig_signature);
|
err = git_signature_dup(&py_hunk->orig_signature,
|
||||||
|
hunk->orig_signature);
|
||||||
py_hunk->boundary = hunk->boundary;
|
if (err < 0)
|
||||||
|
return Error_set(err);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
py_hunk->boundary = hunk->boundary;
|
||||||
return (PyObject*) py_hunk;
|
return (PyObject*) py_hunk;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -54,6 +54,7 @@ RefLogIter_iternext(RefLogIter *self)
|
|||||||
{
|
{
|
||||||
const git_reflog_entry *entry;
|
const git_reflog_entry *entry;
|
||||||
RefLogEntry *py_entry;
|
RefLogEntry *py_entry;
|
||||||
|
int err;
|
||||||
|
|
||||||
if (self->i < self->size) {
|
if (self->i < self->size) {
|
||||||
entry = git_reflog_entry_byindex(self->reflog, self->i);
|
entry = git_reflog_entry_byindex(self->reflog, self->i);
|
||||||
@@ -62,7 +63,10 @@ RefLogIter_iternext(RefLogIter *self)
|
|||||||
py_entry->oid_old = git_oid_allocfmt(git_reflog_entry_id_old(entry));
|
py_entry->oid_old = git_oid_allocfmt(git_reflog_entry_id_old(entry));
|
||||||
py_entry->oid_new = git_oid_allocfmt(git_reflog_entry_id_new(entry));
|
py_entry->oid_new = git_oid_allocfmt(git_reflog_entry_id_new(entry));
|
||||||
py_entry->message = strdup(git_reflog_entry_message(entry));
|
py_entry->message = strdup(git_reflog_entry_message(entry));
|
||||||
git_signature_dup(&py_entry->signature, git_reflog_entry_committer(entry));
|
err = git_signature_dup(&py_entry->signature,
|
||||||
|
git_reflog_entry_committer(entry));
|
||||||
|
if (err < 0)
|
||||||
|
return Error_set(err);
|
||||||
|
|
||||||
++(self->i);
|
++(self->i);
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user