Handle OOM case for result object.

This commit is contained in:
Joachim Bauch
2013-03-08 23:58:49 +01:00
parent 44ae72da04
commit 6f4f2bdd5b
+8
View File
@@ -378,6 +378,14 @@ HMEMORYMODULE MemoryLoadLibraryEx(const void *data,
}
result = (PMEMORYMODULE)HeapAlloc(GetProcessHeap(), 0, sizeof(MEMORYMODULE));
if (result == NULL) {
#if DEBUG_OUTPUT
OutputLastError("Can't reserve memory");
#endif
VirtualFree(code, 0, MEM_RELEASE);
return NULL;
}
result->codeBase = code;
result->numModules = 0;
result->modules = NULL;