git: 9front

Download patch

ref: 7e0e5709547c0f44df220c12614d67ad41487c6d
parent: e29b1e3ff86c9e181ec6a2586c06e0fdb86aeac0
author: Ori Bernstein <ori@eigenstate.org>
date: Tue Dec 7 19:20:32 EST 2021

git: fully init objq

we were leaving objq.best uninitialized, and
would therefore read garbage if we didn't
find a best match.

--- a/sys/src/cmd/git/ref.c
+++ b/sys/src/cmd/git/ref.c
@@ -217,6 +217,7 @@
 
 	osinit(&keep);
 	osinit(&drop);
+	memset(&objq, 0, sizeof(objq));
 	qinit(&objq);
 	objq.head = head;
 	objq.nhead = nhead;
@@ -335,9 +336,9 @@
 
 	if(paint(&a->hash, 1, &b->hash, 1, &o, &n, 1) == -1 || n == 0)
 		return nil;
-	r = o[0];
+	r = ref(o[0]);
 	free(o);
-	return ref(r);
+	return r;
 }
 
 int
--