Malloc and Free in c

void *ptr;
size_t size = BUFSIZ;
 
ptr = malloc(size);
 
/* some further execution happens here... */
 
/* now the buffer size needs to be doubled */

size *= 2;
ptr = realloc(ptr, size);
What is potential error in these set of c statements?

Comments

Popular posts from this blog