From 72de99aed31da6f4ed4ad3e319a5a91d58ab38b4 Mon Sep 17 00:00:00 2001 From: "Ryan C. Gordon" Date: Wed, 23 Oct 2013 19:52:14 -0400 Subject: [PATCH] Initialize MEMORYSTATUSEX size before GlobalMemoryStatusEx() (thanks, Justin!). Fixes Bugzilla #2177. --- src/cpuinfo/SDL_cpuinfo.c | 1 + 1 file changed, 1 insertion(+) diff --git a/src/cpuinfo/SDL_cpuinfo.c b/src/cpuinfo/SDL_cpuinfo.c index f9b764026..fcb600656 100644 --- a/src/cpuinfo/SDL_cpuinfo.c +++ b/src/cpuinfo/SDL_cpuinfo.c @@ -642,6 +642,7 @@ SDL_GetSystemRAM(void) #ifdef __WIN32__ if (SDL_SystemRAM <= 0) { MEMORYSTATUSEX stat; + stat.dwLength = sizeof(stat); if (GlobalMemoryStatusEx(&stat)) { SDL_SystemRAM = (int)(stat.ullTotalPhys / (1024 * 1024)); }