summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/commit.c2
-rw-r--r--src/git/commit.h6
-rw-r--r--src/revwalk.c1
3 files changed, 8 insertions, 1 deletions
diff --git a/src/commit.c b/src/commit.c
index eda57c53e..58abd58a7 100644
--- a/src/commit.c
+++ b/src/commit.c
@@ -204,7 +204,7 @@ int git_commit__parse_buffer(git_commit *commit, void *data, size_t len)
if (commit->uninteresting)
parent->uninteresting = 1;
- if (git_commit_list_push_back(&commit->parents, parent))
+ if (git_commit_list_push_back(&commit->parents, parent) < 0)
return GIT_ENOMEM;
}
diff --git a/src/git/commit.h b/src/git/commit.h
index 1a57ba732..0ccf3c246 100644
--- a/src/git/commit.h
+++ b/src/git/commit.h
@@ -18,6 +18,9 @@ typedef struct git_commit git_commit;
/**
* Locate a reference to a commit without loading it.
+ * The generated commit object is owned by the revision
+ * pool and shall not be freed by the user.
+ *
* @param pool the pool to use when locating the commit.
* @param id identity of the commit to locate. If the object is
* an annotated tag it will be peeled back to the commit.
@@ -28,6 +31,9 @@ GIT_EXTERN(git_commit *) git_commit_lookup(git_revpool *pool, const git_oid *id)
/**
* Locate a reference to a commit, and try to load and parse it it from
* the commit cache or the object database.
+ * The generated commit object is owned by the revision
+ * pool and shall not be freed by the user.
+ *
* @param pool the pool to use when parsing/caching the commit.
* @param id identity of the commit to locate. If the object is
* an annotated tag it will be peeled back to the commit.
diff --git a/src/revwalk.c b/src/revwalk.c
index c3b53a351..431007a7f 100644
--- a/src/revwalk.c
+++ b/src/revwalk.c
@@ -54,6 +54,7 @@ void gitrp_free(git_revpool *walk)
git_revpool_tableit_init(walk->commits, &it);
while ((commit = (git_commit *)git_revpool_tableit_next(&it)) != NULL) {
+ git_commit_list_clear(&commit->parents, 0);
free(commit);
}