Initialize MEMORYSTATUSEX size before GlobalMemoryStatusEx() (thanks, Justin!).
authorRyan C. Gordon <icculus@icculus.org>
Wed, 23 Oct 2013 19:52:14 -0400
changeset 7889 9ec71e56071c
parent 7888 c2144248ccf6
child 7890 c031abe0b287
Initialize MEMORYSTATUSEX size before GlobalMemoryStatusEx() (thanks, Justin!). Fixes Bugzilla #2177.
src/cpuinfo/SDL_cpuinfo.c
--- a/src/cpuinfo/SDL_cpuinfo.c	Wed Oct 23 16:33:15 2013 -0700
+++ b/src/cpuinfo/SDL_cpuinfo.c	Wed Oct 23 19:52:14 2013 -0400
@@ -642,6 +642,7 @@
 #ifdef __WIN32__
         if (SDL_SystemRAM <= 0) {
             MEMORYSTATUSEX stat;
+            stat.dwLength = sizeof(stat);
             if (GlobalMemoryStatusEx(&stat)) {
                 SDL_SystemRAM = (int)(stat.ullTotalPhys / (1024 * 1024));
             }