Commit Diff


commit - 744d93265df30ca836528ad12d5c1d0d980570a9
commit + e302c59e513bd3808c6c02c3b3237ba3d0267114
blob - 5274de47c0e7d96705975773efe4b2f31d60d543
blob + f9e00579124217385f5281a5f9e60a73edfa5bc9
--- lib/object.c
+++ lib/object.c
@@ -229,8 +229,13 @@ read_object_header(struct got_object **obj, struct got
 		err = inflate_read(&zb, f, &outlen);
 		if (err)
 			goto done;
-		if (strchr(zb.outbuf, '\0') == NULL)
+		if (strchr(zb.outbuf, '\0') == NULL) {
 			buf = recallocarray(buf, 1 + i, 2 + i, zbsize);
+			if (buf == NULL) {
+				err = got_error(GOT_ERR_NO_MEM);
+				goto done;
+			}
+		}
 		memcpy(buf, zb.outbuf, outlen);
 		totlen += outlen;
 		i++;