plug error leak in got_packidx_init_hdr(); found by jj@ with scan-build
diff --git a/lib/pack.c b/lib/pack.c
index fedfa0d..b39b112 100644
--- a/lib/pack.c
+++ b/lib/pack.c
@@ -95,9 +95,10 @@ got_packidx_init_hdr(struct got_packidx *p, int verify)
goto done;
}
n = read(p->fd, h->magic, sizeof(*h->magic));
- if (n < 0)
+ if (n < 0) {
err = got_error_from_errno("read");
- else if (n != sizeof(*h->magic)) {
+ goto done;
+ } else if (n != sizeof(*h->magic)) {
err = got_error(GOT_ERR_BAD_PACKIDX);
goto done;
}