...
Code Block | ||
---|---|---|
| ||
char *p2;
char *p = malloc(100);
/* ... */
if ((p2 = realloc(p, nsize)) == NULL) {
if (p) free(p);
p = NULL;
return NULL;
}
p = p2;
|
...
Code Block | ||
---|---|---|
| ||
char *p2; char *p = malloc(100); /* ... */ if ( (nsize == 0) || (p2 = realloc(p, nsize)) == NULL) { if (p) free(p); p = NULL; return NULL; } p = p2; |
...