diff options
author | Vicent Martà <vicent@github.com> | 2013-05-09 09:08:44 -0700 |
---|---|---|
committer | Vicent Martà <vicent@github.com> | 2013-05-09 09:08:44 -0700 |
commit | aca2d26a5c12a225572fbf51a094aa2bb88ad913 (patch) | |
tree | 46788d23a760cf97056d344ac518d5df36f806d2 | |
parent | 9ca4ff41eb4fae26b9336d440953bc6be752f832 (diff) | |
parent | 617bb17556ae97a3e21b502c7fed1acfe9e1370a (diff) | |
download | libgit2-aca2d26a5c12a225572fbf51a094aa2bb88ad913.tar.gz |
Merge pull request #1566 from ethomson/ref_zero
calloc refs instead of malloc'ing them
-rw-r--r-- | src/refdb_fs.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/src/refdb_fs.c b/src/refdb_fs.c index c0a32bae7..bb2cd0a73 100644 --- a/src/refdb_fs.c +++ b/src/refdb_fs.c @@ -106,7 +106,7 @@ static int packed_parse_oid( refname_len = refname_end - refname_begin; - ref = git__malloc(sizeof(struct packref) + refname_len + 1); + ref = git__calloc(1, sizeof(struct packref) + refname_len + 1); GITERR_CHECK_ALLOC(ref); memcpy(ref->name, refname_begin, refname_len); @@ -316,7 +316,7 @@ static int loose_lookup_to_packfile( git_buf_rtrim(&ref_file); name_len = strlen(name); - ref = git__malloc(sizeof(struct packref) + name_len + 1); + ref = git__calloc(1, sizeof(struct packref) + name_len + 1); GITERR_CHECK_ALLOC(ref); memcpy(ref->name, name, name_len); |