Skip to content

Commit 9a3909f

Browse files
committed
Memory (Windows): check for error cases
1 parent 6ca4b53 commit 9a3909f

File tree

2 files changed

+6
-2
lines changed

2 files changed

+6
-2
lines changed

src/detection/memory/memory_windows.c

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,11 @@ void ffDetectMemory(FFMemoryStorage* ram)
55
MEMORYSTATUSEX statex = {
66
.dwLength = sizeof(statex),
77
};
8-
GlobalMemoryStatusEx(&statex);
8+
if (!GlobalMemoryStatusEx(&statex))
9+
{
10+
ffStrbufAppendS(&ram->error, "GlobalMemoryStatusEx() failed");
11+
return;
12+
}
913
ram->bytesTotal = statex.ullTotalPhys;
1014
ram->bytesUsed = statex.ullTotalPhys - statex.ullAvailPhys;
1115
}

src/detection/swap/swap_windows.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ void ffDetectSwap(FFMemoryStorage* swap)
2323
{
2424
if(!(pstart = (SYSTEM_PAGEFILE_INFORMATION*)realloc(pstart, size)))
2525
{
26-
ffStrbufAppendF(&swap->error, "relloc(pstart, %lu) failed", size);
26+
ffStrbufAppendF(&swap->error, "realloc(pstart, %lu) failed", size);
2727
return;
2828
}
2929
}

0 commit comments

Comments
 (0)