-
Notifications
You must be signed in to change notification settings - Fork 78
Open
Labels
Description
In pgut_malloc function, it call malloc function to resuqest memory. Whether it will need call memset function to initialize the requested memeory.
`void *
pgut_malloc(size_t size)
{
char *ret;
if ((ret = malloc(size)) == NULL)
ereport(ERROR,
(errcode(ERROR_NOMEM),
errmsg("could not allocate memory (%lu bytes): %s",
(unsigned long) size, strerror(errno))));
return ret;
}`
Like the function pgut_realloc function usage.
`p = pgut_realloc(array->data, sizeof(void *) * newsize);
/* initialize expanded area to NULL */
memset(p + array->alloced, 0, (newsize - array->alloced) * sizeof(void *));`