clear sha1 digest before parsing
diff --git a/lib/refs.c b/lib/refs.c
index f409652..c520fc2 100644
--- a/lib/refs.c
+++ b/lib/refs.c
@@ -59,6 +59,7 @@ parse_sha1_digest(uint8_t *digest, const char *line)
uint8_t b;
int i, n;
+ memset(digest, 0, SHA1_DIGEST_LENGTH);
for (i = 0; i < SHA1_DIGEST_LENGTH; i++) {
n = sscanf(line, "%hhx", &b);
if (n == 1)