patch 9.1.1129: missing out-of-memory test in buf_write()

Problem:  missing out-of-memory test in buf_write()
Solution: Check that the returned allocated buffer is not NULL
          (John Marriott)

closes: #16678

Signed-off-by: John Marriott <basilisk@internode.on.net>
Signed-off-by: Christian Brabandt <cb@256bit.org>
diff --git a/src/bufwrite.c b/src/bufwrite.c
index 23cd884..e88c7b8 100644
--- a/src/bufwrite.c
+++ b/src/bufwrite.c
@@ -2316,6 +2316,8 @@
 		{
 		    errmsg_allocated = TRUE;
 		    errmsg = alloc(300);
+		    if (errmsg == NULL)
+			goto fail;
 		    vim_snprintf((char *)errmsg, 300, _(e_write_error_conversion_failed_in_line_nr_make_fenc_empty_to_override),
 					 (long)write_info.bw_conv_error_lnum);
 		}