diff options
Diffstat (limited to 'src/sortedcache.c')
| -rw-r--r-- | src/sortedcache.c | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/src/sortedcache.c b/src/sortedcache.c index c6b226153..115175724 100644 --- a/src/sortedcache.c +++ b/src/sortedcache.c @@ -1,6 +1,6 @@ #include "sortedcache.h" -GIT__USE_STRMAP; +GIT__USE_STRMAP int git_sortedcache_new( git_sortedcache **out, @@ -11,11 +11,13 @@ int git_sortedcache_new( const char *path) { git_sortedcache *sc; - size_t pathlen; + size_t pathlen, alloclen; pathlen = path ? strlen(path) : 0; - sc = git__calloc(sizeof(git_sortedcache) + pathlen + 1, 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 || |
