From 511ad67a9a2ba3d4d4fd483021ca728c3e42b839 Mon Sep 17 00:00:00 2001 From: apio Date: Mon, 17 Oct 2022 20:54:32 +0200 Subject: [PATCH] fdopen: Check for malloc errors --- libs/libc/src/file.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/libs/libc/src/file.cpp b/libs/libc/src/file.cpp index 0ef00616..aeda988f 100644 --- a/libs/libc/src/file.cpp +++ b/libs/libc/src/file.cpp @@ -45,6 +45,7 @@ extern "C" return 0; } FILE* stream = (FILE*)malloc(sizeof(FILE)); + if (!stream) { return 0; } stream->f_fd = fd; clearerr(stream); return stream;