From cf946e32ba0977a87bc5c7096c304538b4f42337 Mon Sep 17 00:00:00 2001
From: Semphris <[EMAIL REDACTED]>
Date: Wed, 18 Dec 2024 20:53:27 -0500
Subject: [PATCH] Fix memory management for Windows dialog title
---
src/dialog/windows/SDL_windowsdialog.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/src/dialog/windows/SDL_windowsdialog.c b/src/dialog/windows/SDL_windowsdialog.c
index eb1f35e8843c2..9f647ae2a3310 100644
--- a/src/dialog/windows/SDL_windowsdialog.c
+++ b/src/dialog/windows/SDL_windowsdialog.c
@@ -221,7 +221,7 @@ void windows_ShowFileDialog(void *ptr)
title_len = 0;
}
- int title_wlen = MultiByteToWideChar(CP_UTF8, 0, title, title_len, NULL, 0);
+ int title_wlen = MultiByteToWideChar(CP_UTF8, 0, title, -1, NULL, 0);
if (title_wlen < 0) {
title_wlen = 0;
@@ -236,7 +236,7 @@ void windows_ShowFileDialog(void *ptr)
return;
}
- MultiByteToWideChar(CP_UTF8, 0, title, title_len, title_w, title_wlen);
+ MultiByteToWideChar(CP_UTF8, 0, title, -1, title_w, title_wlen);
}
OPENFILENAMEW dialog;