summaryrefslogtreecommitdiff
path: root/src/sortedcache.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/sortedcache.c')
-rw-r--r--src/sortedcache.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/src/sortedcache.c b/src/sortedcache.c
index 021f79632..1195ea339 100644
--- a/src/sortedcache.c
+++ b/src/sortedcache.c
@@ -11,13 +11,13 @@ int git_sortedcache_new(
const char *path)
{
git_sortedcache *sc;
- size_t pathlen;
+ size_t pathlen, alloclen;
pathlen = path ? strlen(path) : 0;
- GITERR_CHECK_ALLOC_ADD(sizeof(git_sortedcache), pathlen);
- GITERR_CHECK_ALLOC_ADD(sizeof(git_sortedcache) + pathlen, 1);
- sc = git__calloc(1, sizeof(git_sortedcache) + pathlen + 1);
+ GITERR_CHECK_ALLOC_ADD(&alloclen, sizeof(git_sortedcache), pathlen);
+ GITERR_CHECK_ALLOC_ADD(&alloclen, alloclen, 1);
+ sc = git__calloc(1, alloclen);
GITERR_CHECK_ALLOC(sc);
if (git_pool_init(&sc->pool, 1, 0) < 0 ||