Skip to content

Commit 617bb17

Browse files
author
Edward Thomson
committed
calloc refs instead of malloc'ing them
1 parent 9ca4ff4 commit 617bb17

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/refdb_fs.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,7 @@ static int packed_parse_oid(
106106

107107
refname_len = refname_end - refname_begin;
108108

109-
ref = git__malloc(sizeof(struct packref) + refname_len + 1);
109+
ref = git__calloc(1, sizeof(struct packref) + refname_len + 1);
110110
GITERR_CHECK_ALLOC(ref);
111111

112112
memcpy(ref->name, refname_begin, refname_len);
@@ -316,7 +316,7 @@ static int loose_lookup_to_packfile(
316316
git_buf_rtrim(&ref_file);
317317

318318
name_len = strlen(name);
319-
ref = git__malloc(sizeof(struct packref) + name_len + 1);
319+
ref = git__calloc(1, sizeof(struct packref) + name_len + 1);
320320
GITERR_CHECK_ALLOC(ref);
321321

322322
memcpy(ref->name, name, name_len);

0 commit comments

Comments
 (0)