Skip to content

Commit 7cd123b

Browse files
committed
Return null for zero-byte allocations
1 parent f0f9d99 commit 7cd123b

File tree

5 files changed

+477
-475
lines changed

5 files changed

+477
-475
lines changed

MEMMGR.C

+6-5
Original file line numberDiff line numberDiff line change
@@ -66,12 +66,13 @@ DWORD SetPages(PVOID pLinear, DWORD dwPhysical, INT nPages)
6666

6767
PVOID MemAlloc(INT cbSize)
6868
{
69-
PVOID p;
70-
71-
p = pFree;
72-
pFree += cbSize;
73-
pLinFree += cbSize;
69+
PVOID p = NULL;
7470

71+
if (cbSize) {
72+
p = pFree;
73+
pFree += cbSize;
74+
pLinFree += cbSize;
75+
}
7576
return p;
7677
}
7778

SPY.COM

256 Bytes
Binary file not shown.

0 commit comments

Comments
 (0)