Manual Page Search Parameters

MALLOC(3) Library Functions Manual MALLOC(3)

reallocfmemory reallocation function

Standard C Library (libc, -lc)

#include <stdlib.h>

void *
reallocf(void *ptr, size_t size);

The () function is identical to the () function, except that it will free the passed pointer when the requested memory cannot be allocated. This is a FreeBSD specific API designed to ease the problems with traditional coding styles for realloc() causing memory leaks in libraries.

The reallocf() function returns a pointer, possibly identical to ptr, to the allocated memory if successful; otherwise a NULL pointer is returned, and errno is set to ENOMEM if the error was the result of an allocation failure. The reallocf() function deletes the original buffer when an error occurs.

realloc(3)

The reallocf() function first appeared in FreeBSD 3.0.

January 31, 2010 dev