]> git.ipfire.org Git - thirdparty/git.git/blobdiff - commit.c
use st_add and st_mult for allocation size computation
[thirdparty/git.git] / commit.c
index 31cd91f81ea54c056dba34e0b748fe1fee8ed29a..3f4f371e5eec41fa67345c0b9d373b541e52172a 100644 (file)
--- a/commit.c
+++ b/commit.c
@@ -147,7 +147,7 @@ struct commit_graft *read_graft_line(char *buf, int len)
        if ((len + 1) % entry_size)
                goto bad_graft_data;
        i = (len + 1) / entry_size - 1;
-       graft = xmalloc(sizeof(*graft) + GIT_SHA1_RAWSZ * i);
+       graft = xmalloc(st_add(sizeof(*graft), st_mult(GIT_SHA1_RAWSZ, i)));
        graft->nr_parent = i;
        if (get_oid_hex(buf, &graft->oid))
                goto bad_graft_data;