Initialize MEMORYSTATUSEX size before GlobalMemoryStatusEx() (thanks, Justin!).
authorRyan C. Gordon <icculus@icculus.org>
Wed, 23 Oct 2013 19:52:14 -0400
changeset 78899ec71e56071c
parent 7888 c2144248ccf6
child 7890 c031abe0b287
Initialize MEMORYSTATUSEX size before GlobalMemoryStatusEx() (thanks, Justin!).

Fixes Bugzilla #2177.
src/cpuinfo/SDL_cpuinfo.c
     1.1 --- a/src/cpuinfo/SDL_cpuinfo.c	Wed Oct 23 16:33:15 2013 -0700
     1.2 +++ b/src/cpuinfo/SDL_cpuinfo.c	Wed Oct 23 19:52:14 2013 -0400
     1.3 @@ -642,6 +642,7 @@
     1.4  #ifdef __WIN32__
     1.5          if (SDL_SystemRAM <= 0) {
     1.6              MEMORYSTATUSEX stat;
     1.7 +            stat.dwLength = sizeof(stat);
     1.8              if (GlobalMemoryStatusEx(&stat)) {
     1.9                  SDL_SystemRAM = (int)(stat.ullTotalPhys / (1024 * 1024));
    1.10              }