Commit 590ff98166228638f9cf730aff7d5d044ce67f91

Edward Thomson 2022-01-21T19:49:09

oid: don't assume the size of an oid Don't assume that a `git_oid` is a particular size; allocate `sizeof(git_oid)` instead.

diff --git a/src/libgit2/remote.c b/src/libgit2/remote.c
index 1a79faa..3d05937 100644
--- a/src/libgit2/remote.c
+++ b/src/libgit2/remote.c
@@ -1830,7 +1830,7 @@ static int update_one_tip(
 	}
 
 	if (error == GIT_ENOTFOUND) {
-		memset(&old, 0, GIT_OID_RAWSZ);
+		memset(&old, 0, sizeof(git_oid));
 		error = 0;
 
 		if (autotag && (error = git_vector_insert(update_heads, head)) < 0)
diff --git a/tests/libgit2/pack/packbuilder.c b/tests/libgit2/pack/packbuilder.c
index f235798..0889f46 100644
--- a/tests/libgit2/pack/packbuilder.c
+++ b/tests/libgit2/pack/packbuilder.c
@@ -68,7 +68,7 @@ static void seed_packbuilder(void)
 	cl_git_pass(git_revwalk_push_ref(_revwalker, "HEAD"));
 
 	while (git_revwalk_next(&oid, _revwalker) == 0) {
-		o = git__malloc(GIT_OID_RAWSZ);
+		o = git__malloc(sizeof(git_oid));
 		cl_assert(o != NULL);
 		git_oid_cpy(o, &oid);
 		cl_git_pass(git_vector_insert(&_commits, o));