Commit Diff


commit - 03a62f6dd737910257cd4602766adca863cc8811
commit + be12ea2c3492ea9c1292c0c73e59723ead326d6d
blob - 6c9c61a414a0d5c844ce86e60e9544b213cd637c
blob + d367657cf7189b3acce06cec296174ac9016c349
--- gotd/session_write.c
+++ gotd/session_write.c
@@ -696,7 +696,9 @@ update_ref(int *shut, struct gotd_session_client *clie
 
 	log_debug("updating ref %s for uid %d", refname, client->euid);
 
+	memset(&old_id, 0, sizeof(old_id));
 	memcpy(old_id.sha1, iref.old_id, SHA1_DIGEST_LENGTH);
+	memset(&new_id, 0, sizeof(new_id));
 	memcpy(new_id.sha1, iref.new_id, SHA1_DIGEST_LENGTH);
 	err = got_repo_find_object_id(iref.delete_ref ? &old_id : &new_id,
 	    repo);
blob - e4574472a88375bfac44ed049b2e5050ad77a389
blob + 46993566dd31424cd682958ab880fa97a0c65211
--- lib/object_qid.c
+++ lib/object_qid.c
@@ -31,7 +31,7 @@
 const struct got_error *
 got_object_qid_alloc_partial(struct got_object_qid **qid)
 {
-	*qid = malloc(sizeof(**qid));
+	*qid = calloc(1, sizeof(**qid));
 	if (*qid == NULL)
 		return got_error_from_errno("malloc");