LocalFree

  HLOCAL LocalFree(hloc)    
  HLOCAL hloc; /* handle of local memory object to free */

The LocalFree function frees the given local memory block (if the block is not locked) and invalidates its handle.

Parameters

hloc

Identifies the local memory block to be freed.

Return Value

The return value is NULL if the function is successful. Otherwise, the return value is equal to the hloc parameter. Use the GetLastError function to obtain extended error information.

Comments

An application cannot use the LocalFree function to free a locked memory block (a memory block with a lock count greater than zero).

After freeing the handle of the memory block, an application cannot use the handle again. An attempt to free the same memory block more than once can cause Windows to terminate abnormally.

See Also

LocalAlloc, GlobalAlloc, GlobalFree, HeapAlloc, HeapFree, VirtualAlloc, VirtualFree