shithub: git9

Download patch

ref: dee2d0ad28cfe6ec789c7597f678c54168918bad
parent: 7c271bdf8a13cc1645f16448e47f16c5720cdf17
author: Ori Bernstein <ori@eigenstate.org>
date: Sun Jan 31 17:57:11 EST 2021

git/log, git/query: fix refcounting on expressions (thanks mcf)

Git/log and git/query can crash in range() because we unref the
parent commits too many times; this fixes the issue.

--- a/ref.c
+++ b/ref.c
@@ -389,6 +389,7 @@
 			*p = obj[i];
 			return i;
 		}
+		unref(obj[i]);
 	}
 	return -1;
 }
@@ -441,7 +442,6 @@
 			werrstr("not commit: %H", q->hash);
 			goto error;
 		}
-		unref(p);
 		p = q;
 		nall++;
 	}