From b82f2af46712948a1252e539cd649b4c996a252f Mon Sep 17 00:00:00 2001 From: Brian Matherly Date: Sat, 2 Dec 2023 13:17:08 -0600 Subject: [PATCH] Fix memory leak in win32_fopen() --- src/win32/win32.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/win32/win32.c b/src/win32/win32.c index 9fb0bdd10..8267b67b5 100644 --- a/src/win32/win32.c +++ b/src/win32/win32.c @@ -254,11 +254,12 @@ FILE* win32_fopen(const char *filename_utf8, const char *mode_utf8) MultiByteToWideChar(CP_UTF8, 0, filename_utf8, -1, filename_w, n); MultiByteToWideChar(CP_UTF8, 0, mode_utf8, -1, mode_w, n); FILE *fh = _wfopen(filename_w, mode_w); - free(filename_w); + free(mode_w); if (fh) return fh; } } + free(filename_w); } } // Try with regular old fopen.