init output param in {parse,read}_object_header
diff --git a/libexec/got-read-object/got-read-object.c b/libexec/got-read-object/got-read-object.c
index 2d71593..7738a57 100644
--- a/libexec/got-read-object/got-read-object.c
+++ b/libexec/got-read-object/got-read-object.c
@@ -72,6 +72,8 @@ parse_object_header(struct got_object **obj, char *buf, size_t len)
int i;
char *p = strchr(buf, '\0');
+ *obj = NULL;
+
if (p == NULL)
return got_error(GOT_ERR_BAD_OBJ_HDR);
@@ -116,6 +118,8 @@ read_object_header(struct got_object **obj, int fd)
size_t outlen, totlen;
int nbuf = 1;
+ *obj = NULL;
+
buf = malloc(zbsize);
if (buf == NULL)
return got_error_from_errno();