5 * LICENSE: Public domain
6 * PROJECT: ReactOS system libraries
7 * FILE: reactos/lib/psapi/misc/malloc.c
8 * PURPOSE: Memory allocator for PSAPI
9 * PROGRAMMER: KJK::Hyperion <noog@libero.it>
12 * 12/02/2003: malloc and free renamed to PsaiMalloc and PsaiFree,
13 * for better reusability
16 #include <ddk/ntddk.h>
18 #include <ntos/heap.h>
20 PVOID STDCALL MemAlloc
29 if(Size == 0 && Ptr == NULL)
33 Heap = NtCurrentPeb()->ProcessHeap;
39 pBuf = RtlAllocateHeap(Heap, 0, Size);
42 pBuf = RtlReAllocateHeap(Heap, 0, Ptr, Size);
46 RtlFreeHeap(Heap, 0, Ptr);
51 void *PsaiMalloc(SIZE_T size)
53 return MemAlloc(NULL, NULL, size);
56 void *PsaiRealloc(void *ptr, SIZE_T size)
58 return MemAlloc(NULL, ptr, size);
61 void PsaiFree(void *ptr)
63 MemAlloc(NULL, ptr, 0);