summaryrefslogtreecommitdiff
path: root/src/odb.c
diff options
context:
space:
mode:
authorVicent Marti <tanoku@gmail.com>2014-11-21 13:50:46 +0100
committerVicent Marti <tanoku@gmail.com>2014-11-21 14:09:53 +0100
commite015665142fad7314581063b25202f32631d510e (patch)
treec3aeae51d9e4f367438a4e9b70b2353ba069d903 /src/odb.c
parentfc6ac074ee7ea945819e0a1d6f65ba160ba403d7 (diff)
downloadlibgit2-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.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/odb.c b/src/odb.c
index 2c19c0311..5961b35a7 100644
--- a/src/odb.c
+++ b/src/odb.c
@@ -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;