Commit 346b301a6191bd87507ba2768ce7a2adae448a06

Stefan Sperling 2019-10-06T18:51:41

check for errors from buf_append() in diff3.c's diff_output()

diff --git a/lib/diff3.c b/lib/diff3.c
index db53387..4d9643e 100644
--- a/lib/diff3.c
+++ b/lib/diff3.c
@@ -173,6 +173,7 @@ static const struct got_error *diff3_internal(char *, char *, char *,
 static const struct got_error *
 diff_output(BUF *diffbuf, const char *fmt, ...)
 {
+	const struct got_error *err = NULL;
 	va_list vap;
 	int i;
 	char *str;
@@ -183,9 +184,9 @@ diff_output(BUF *diffbuf, const char *fmt, ...)
 	va_end(vap);
 	if (i == -1)
 		return got_error_from_errno("vasprintf");
-	buf_append(&newsize, diffbuf, str, strlen(str));
+	err = buf_append(&newsize, diffbuf, str, strlen(str));
 	free(str);
-	return NULL;
+	return err;
 }
 
 static const struct got_error*