From c9b243fb5647d651a0ae49029ce43b38c2b0aad6 Mon Sep 17 00:00:00 2001
From: Sam Lantinga <[EMAIL REDACTED]>
Date: Mon, 4 Dec 2023 20:30:52 -0800
Subject: [PATCH] Fixed warning C6263: Using _alloca in a loop: this can
quickly overflow stack.
---
src/video/windows/SDL_windowsevents.c | 5 ++---
1 file changed, 2 insertions(+), 3 deletions(-)
diff --git a/src/video/windows/SDL_windowsevents.c b/src/video/windows/SDL_windowsevents.c
index 1c45f711a74b..4c2bb0be1e9b 100644
--- a/src/video/windows/SDL_windowsevents.c
+++ b/src/video/windows/SDL_windowsevents.c
@@ -1288,16 +1288,15 @@ WIN_WindowProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
HDROP drop = (HDROP)wParam;
UINT count = DragQueryFile(drop, 0xFFFFFFFF, NULL, 0);
for (i = 0; i < count; ++i) {
- SDL_bool isstack;
UINT size = DragQueryFile(drop, i, NULL, 0) + 1;
- LPTSTR buffer = SDL_small_alloc(TCHAR, size, &isstack);
+ LPTSTR buffer = (LPTSTR)SDL_malloc(sizeof(TCHAR) * size);
if (buffer) {
if (DragQueryFile(drop, i, buffer, size)) {
char *file = WIN_StringToUTF8(buffer);
SDL_SendDropFile(data->window, NULL, file);
SDL_free(file);
}
- SDL_small_free(buffer, isstack);
+ SDL_free(buffer);
}
}
SDL_SendDropComplete(data->window);