Thread (19 messages) 19 messages, 3 authors, 2d ago

Re: [PATCH 09/11] bisect: check strbuf_getline_lf return when reading terms

From: Junio C Hamano <hidden>
Date: 2026-07-15 01:17:08

"Johannes Schindelin via GitGitGadget" [off-list ref]
writes:
quoted hunk ↗ jump to hunk
diff --git a/builtin/bisect.c b/builtin/bisect.c
index 798e28f501..fe66d84382 100644
--- a/builtin/bisect.c
+++ b/builtin/bisect.c
@@ -498,9 +498,15 @@ static int get_terms(struct bisect_terms *terms)
 	}
 
 	free_terms(terms);
-	strbuf_getline_lf(&str, fp);
+	if (strbuf_getline_lf(&str, fp) == EOF) {
+		res = -1;
+		goto finish;
+	}
 	terms->term_bad = strbuf_detach(&str, NULL);
-	strbuf_getline_lf(&str, fp);
+	if (strbuf_getline_lf(&str, fp) == EOF) {
+		res = -1;
+		goto finish;
+	}
We want to clean-up terms->term_bad when we fail to read the second
line after reading the first line successfully, no?
 	terms->term_good = strbuf_detach(&str, NULL);
 
 finish:
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help