Fix bug in w32_memory_info
* src/w32.c (w32_memory_info): Initialize struct size.
This commit is contained in:
parent
7738641205
commit
58d3d4820a
1 changed files with 4 additions and 2 deletions
|
@ -7659,7 +7659,7 @@ w32_memory_info (unsigned long long *totalram, unsigned long long *freeram,
|
||||||
{
|
{
|
||||||
MEMORYSTATUS memst;
|
MEMORYSTATUS memst;
|
||||||
MEMORY_STATUS_EX memstex;
|
MEMORY_STATUS_EX memstex;
|
||||||
|
memstex.dwLength = sizeof(memstex);
|
||||||
/* Use GlobalMemoryStatusEx if available, as it can report more than
|
/* Use GlobalMemoryStatusEx if available, as it can report more than
|
||||||
2GB of memory. */
|
2GB of memory. */
|
||||||
if (global_memory_status_ex (&memstex))
|
if (global_memory_status_ex (&memstex))
|
||||||
|
@ -7670,7 +7670,9 @@ w32_memory_info (unsigned long long *totalram, unsigned long long *freeram,
|
||||||
*freeswap = memstex.ullAvailPageFile;
|
*freeswap = memstex.ullAvailPageFile;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
else if (global_memory_status (&memst))
|
|
||||||
|
memst.dwLength = sizeof(memst);
|
||||||
|
if (global_memory_status (&memst))
|
||||||
{
|
{
|
||||||
*totalram = memst.dwTotalPhys;
|
*totalram = memst.dwTotalPhys;
|
||||||
*freeram = memst.dwAvailPhys;
|
*freeram = memst.dwAvailPhys;
|
||||||
|
|
Loading…
Add table
Reference in a new issue