fix memleak in error case of got-read-commit
diff --git a/libexec/got-read-commit/got-read-commit.c b/libexec/got-read-commit/got-read-commit.c
index 19ddcf4..3ec8615 100644
--- a/libexec/got-read-commit/got-read-commit.c
+++ b/libexec/got-read-commit/got-read-commit.c
@@ -60,8 +60,10 @@ read_commit_object(struct got_commit_object **commit, FILE *f)
return err;
err = got_object_parse_header(&obj, p, len);
- if (err)
+ if (err) {
+ free(p);
return err;
+ }
if (len < obj->hdrlen + obj->size) {
err = got_error(GOT_ERR_BAD_OBJ_DATA);