Does AllocMem() give error messages?

May 20, 2008
12,365
137
Syracuse, NY, USA
Should I

Code:
if ( (pInfo = (PIP_ADAPTER_ADDRESSES) AllocMem(dwInfoSize)) == NULL )
{
    error(ERROR_NOT_ENOUGH_MEMORY, NULL);
    return 0;
}
or can I rely on AllocMem() to generate an error message?
 
> Code:
> ---------
> if ( (pInfo = (PIP_ADAPTER_ADDRESSES) AllocMem(dwInfoSize)) == NULL )
> {
> error(ERROR_NOT_ENOUGH_MEMORY, NULL);
> return 0;
> }
> ---------
> or can I rely on AllocMem() to generate an error message?

AllocMem does not return error messages, just a null if it can't allocate
memory. (If it can't, your system is probably toast anyway, as all of the
virtual memory will have been eaten.)

Rex
 

Similar threads