#include <Windows.h>
#include "allocators.h"


/* these want be a secure alloc/free wrappers with the following characteristics

alloc:
- unsigned int for size parameter
- check against max size allocation: TODO define max size
- check against zero bytes allocation
- zero out allocated memory

free:
- check against NULL before freeing
- assign NULL to ptr after freeing


clients:
- check return values against NULL
- cast immediately the returned type, i.e.
#define MALLOC(type) ((type) malloc(sizeof(type)))
#define MALLOC_ARRAY(number, type) ((type*) malloc((number) * sizeof(type)))

N.B.: feel free to add any additional secure oriented allocation feature and document it
*/




LPVOID salloc(__in size_t dwSize)
{

	if (dwSize == 0)
		return NULL;

	VOID *pMem = (VOID*)malloc(dwSize);

	SecureZeroMemory(pMem, dwSize);

	return pMem;
}

VOID sfree(__in LPVOID pMem)
{
	if (pMem)
	{
		
		free(pMem);

		pMem = NULL;
	}

}
