PATCH : free(NULL) in cpphash.c
Tue Apr 4 21:54:00 GMT 2000
On Wed, Apr 05, 2000 at 06:49:15AM +0200, Philippe De Muyter wrote:
> In cpphash.c/_cpp_free_definition, one frees d->argnames iff d->nargs >= 0.
> But in collect_expansion, nargs is copied from argc which itself is a copy
> of arglist->argc while argnames is copied from arglist->namebuf. And in
> collect_formal_parameters, argc can set to 0 while namebuf is set to NULL.
> In short, argnames can be NULL even when nargs >= 0.
free(NULL) is defined to be a no-op, so the code should be safe as is.
Can you provide a test case which does not work with the existing
I will apply the patch anyway, because it's clearer that way; thank
you for pointing out the inconsistency.
More information about the Gcc-patches