From da72f6c54b878abef631f0cfd23b99d99f33dea4 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Deuc=D0=B5?= <shurd@sasktel.net>
Date: Sat, 4 Jan 2025 23:21:35 -0500
Subject: [PATCH] Fix possible NULL dereference

Caught by scan-build.
Not actually possible with any of the current backends, but the API
would allow it to happen.
---
 src/conio/ciolib.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/src/conio/ciolib.c b/src/conio/ciolib.c
index 00ea8748e3..89d18dc774 100644
--- a/src/conio/ciolib.c
+++ b/src/conio/ciolib.c
@@ -1285,6 +1285,8 @@ CIOLIBEXPORT int ciolib_gettext(int a,int b,int c,int d,void *e)
 	CIOLIB_INIT();
 
 	if (cio_api.gettext == NULL) {
+		if (cio_api.vmem_gettext == NULL)
+			return 0;
 		buf = malloc((c-a+1)*(d-b+1)*sizeof(*buf));
 		if (buf == NULL)
 			return 0;
-- 
GitLab