In preparation for new graft struct version introduced in next commit.

Signed-off-by: Patryk Obara <patryk.ob...@gmail.com>
---
 commit.c | 11 ++++++++---
 1 file changed, 8 insertions(+), 3 deletions(-)

diff --git a/commit.c b/commit.c
index 499fb14..4d23e72 100644
--- a/commit.c
+++ b/commit.c
@@ -109,15 +109,20 @@ static int commit_graft_pos(const unsigned char *sha1)
                        commit_graft_sha1_access);
 }
 
+static void free_commit_graft(struct commit_graft *graft)
+{
+       free(graft);
+}
+
 int register_commit_graft(struct commit_graft *graft, int ignore_dups)
 {
        int pos = commit_graft_pos(graft->oid.hash);
 
        if (0 <= pos) {
                if (ignore_dups)
-                       free(graft);
+                       free_commit_graft(graft);
                else {
-                       free(commit_graft[pos]);
+                       free_commit_graft(commit_graft[pos]);
                        commit_graft[pos] = graft;
                }
                return 1;
@@ -163,7 +168,7 @@ struct commit_graft *read_graft_line(struct strbuf *line)
 
 bad_graft_data:
        error("bad graft data: %s", buf);
-       free(graft);
+       free_commit_graft(graft);
        return NULL;
 }
 
-- 
2.9.5

Reply via email to