From 247d1b4c27f22d0e9b4491e6249a59a298aa0d9d Mon Sep 17 00:00:00 2001
From: "Rob Swindell (on Windows 11)" <rob@synchro.net>
Date: Sat, 8 Mar 2025 20:41:14 -0800
Subject: [PATCH] Detect failure (e.g. realloc failure) in
 strListReadFile->strListAppend()

---
 src/xpdev/str_list.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/src/xpdev/str_list.c b/src/xpdev/str_list.c
index a6bb11ea68..f933178096 100644
--- a/src/xpdev/str_list.c
+++ b/src/xpdev/str_list.c
@@ -664,7 +664,8 @@ str_list_t strListReadFile(FILE* fp, str_list_t* lp, size_t max_line_len)
 
 			if (fgets(buf, max_line_len + 1, fp) == NULL)
 				break;
-			strListAppend(lp, buf, count++);
+			if (strListAppend(lp, buf, count++) == NULL)
+				break;
 		}
 		if (!feof(fp)) {
 			strListFreeStrings(list);
-- 
GitLab