MCPcopy Index your code
hub / github.com/F-Stack/f-stack / reallocf

Function reallocf

tools/compat/reallocf.c:30–46  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

28#include "compat.h"
29
30void *
31reallocf(void *ptr, size_t size)
32{
33 void *nptr;
34
35 nptr = realloc(ptr, size);
36
37 /*
38 * When the System V compatibility option (malloc "V" flag) is
39 * in effect, realloc(ptr, 0) frees the memory and returns NULL.
40 * So, to avoid double free, call free() only when size != 0.
41 * realloc(ptr, 0) can't fail when ptr != NULL.
42 */
43 if (!nptr && ptr && size != 0)
44 free(ptr);
45 return (nptr);
46}

Callers 5

sl_addFunction · 0.70
kinfo_getvmobjectFunction · 0.50
__gr_scanFunction · 0.50
ifconfig.cFile · 0.50
searchFunction · 0.50

Calls 2

reallocFunction · 0.50
freeFunction · 0.50

Tested by

no test coverage detected