diff options
author | Vicent Marti <tanoku@gmail.com> | 2014-11-21 13:50:46 +0100 |
---|---|---|
committer | Vicent Marti <tanoku@gmail.com> | 2014-11-21 14:09:53 +0100 |
commit | e015665142fad7314581063b25202f32631d510e (patch) | |
tree | c3aeae51d9e4f367438a4e9b70b2353ba069d903 /src/odb.c | |
parent | fc6ac074ee7ea945819e0a1d6f65ba160ba403d7 (diff) | |
download | libgit2-e015665142fad7314581063b25202f32631d510e.tar.gz |
odb: `git_odb_object` contents are never NULLvmg/empty
This is a contract that we made in the library and that we need to uphold. The
contents of a blob can never be NULL because several parts of the library (including
the filter and attributes code) expect `git_blob_rawcontent` to always return a
valid pointer.
Diffstat (limited to 'src/odb.c')
-rw-r--r-- | src/odb.c | 4 |
1 files changed, 2 insertions, 2 deletions
@@ -762,12 +762,12 @@ static int hardcoded_objects(git_rawobj *raw, const git_oid *id) if (!git_oid_cmp(id, &empty_blob)) { raw->type = GIT_OBJ_BLOB; raw->len = 0; - raw->data = NULL; + raw->data = git__calloc(1, sizeof(uint8_t)); return 0; } else if (!git_oid_cmp(id, &empty_tree)) { raw->type = GIT_OBJ_TREE; raw->len = 0; - raw->data = NULL; + raw->data = git__calloc(1, sizeof(uint8_t)); return 0; } else { return GIT_ENOTFOUND; |