Skip to content

Commit 0c49396

Browse files
committed
Merge branch 'rs/strbuf-getwholeline-fix'
A helper function to read a single whole line into strbuf mistakenly triggered OOM error at EOF under certain conditions, which has been fixed. * rs/strbuf-getwholeline-fix: strbuf: clear errno before calling getdelim(3)
2 parents e2a2a1d + 642956c commit 0c49396

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

strbuf.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -476,6 +476,7 @@ int strbuf_getwholeline(struct strbuf *sb, FILE *fp, int term)
476476
/* Translate slopbuf to NULL, as we cannot call realloc on it */
477477
if (!sb->alloc)
478478
sb->buf = NULL;
479+
errno = 0;
479480
r = getdelim(&sb->buf, &sb->alloc, term, fp);
480481

481482
if (r > 0) {

0 commit comments

Comments
 (0)