free() and implicit conversion to a function pointer (was: Use of initialized variable in strtod.c)

Corinna Vinschen vinschen@redhat.com
Thu Mar 16 08:40:00 GMT 2017


On Mar 15 18:48, Jeffrey Walton wrote:
> > But this in __call_atexit.c is definitely correct. It is
> > treating free() as a weak symbol and the only way to
> > silence Coverity is to add an annotation.
> >
> > 136      /* Don't dynamically free the atexit array if free is not
> > 137         available.  */
> >
> > CID 175323 (#1 of 1): Function address comparison (BAD_COMPARE)
> > func_conv: This implicit conversion to a function pointer is suspicious:
> > free.
> >         Did you intend to call free?
> > 138      if (!free)
> > 139        break;
> 
> Well, I have not encountered that one (yet). Since Coverity is
> complaining about an implicit conversion, maybe the following will
> help to avoid the implicit part (and sidestep the finding):
> 
>     if (free != NULL)
>         break;
> 
> Or perhaps:
> 
>     if ((void*)free != NULL)
>         break;
> 
> If that works to clear the finding, then it is one of those items I
> write-off as "working and playing well with the tools".

Unfortunately you have to tell covreity that "free" is a var, not a function,
but since that's not generally true... marking as false positive.


Corinna

-- 
Corinna Vinschen
Cygwin Maintainer
Red Hat
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: not available
URL: <http://sourceware.org/pipermail/newlib/attachments/20170316/58502146/attachment.sig>


More information about the Newlib mailing list