diff_print: return out-of-memory situation when printing binary We currently don't check for out-of-memory situations on exiting `format_binary` and, as a result, may return a partially filled buffer. Fix this by checking the buffer via `git_buf_oom`.
diff --git a/src/diff_print.c b/src/diff_print.c
index afe2efa..1ef0f1d 100644
--- a/src/diff_print.c
+++ b/src/diff_print.c
@@ -491,6 +491,9 @@ static int format_binary(
}
git_buf_putc(pi->buf, '\n');
+ if (git_buf_oom(pi->buf))
+ return -1;
+
return 0;
}