commit 453dd3ce534a8d94595914e035ff33629f3249b7
parent 3a332e026f17d8a078a1bcd25d8854a884fb9bef
Author: Chris Bracken <chris@bracken.jp>
Date: Fri, 20 Feb 2026 15:29:16 +0900
fs_inmemory: fix a missing bailout
In the case where fmemopen fails, we return NULL immediately to avoid
registering NULL as an active stream.
Diffstat:
1 file changed, 3 insertions(+), 0 deletions(-)
diff --git a/src/fs_inmemory.c b/src/fs_inmemory.c
@@ -57,6 +57,9 @@ static FILE* inmemory_fopen(const char* path, const char* mode) {
if (strcmp(g_files[i].path, path) == 0) {
if (g_files[i].buf) {
FILE* f = fmemopen(g_files[i].buf, strlen(g_files[i].buf), "r");
+ if (!f) {
+ return NULL;
+ }
register_active_stream(f);
return f;
}