Re: Fw: makedoc.c: Coverity Scan Issues

Joel Sherrill <[email protected]>
Newsgroups gmane.comp.lib.newlib
Message-ID <CAF9ehCV+Wg0D5T==S6WVZFeLzKSyKXGOq8YOG7o-YwDHDB0ryg@mail.gmail.com>
On Thu, Jun 17, 2021 at 1:30 PM C Howland <[email protected]> wrote:

> >
> > ------------------------------
> > *From:* Newlib <[email protected]> on
> > behalf of Joel Sherrill <[email protected]>
> > *Sent:* Thursday, June 17, 2021 2:06 PM
> > *To:* Newlib <[email protected]>
> > *Subject:* makedoc.c: Coverity Scan Issues
> >
> >
> > Hi
> >
> > Scan reports 3 issues in makedoc.c.
> >
> >   One  is a memory leak around lines 1202 to 1282 because the variable
> word
> > holds memory allocated inside nextword. The method returns without
> freeing
> > the memory.    I think adding a free() is sufficient for this.
> >
> > The others are from calling realloc() and not checking for NULL around
> line
> > 137. Is checking for the NULL, printing a message, and exit(1), an OK
> thing
> > to do here?
> >
> > Yes, that sounds good.  (Seems very unlikely it would ever happen,
> anyway.)
>

I agree since this is one of the few host based utilities in newlib. But it
seemed
better to address it.

I'll try to post patches shortly.

FWIW there are 61 defects being reported right now for newlib. I'm building
for sparc-rtems6 as we use leon3 as our reference BSP for RTEMS coverity.
It checks a few times a day if the RTEMS newlib git mirror has been updated
and then kicks off an analysis. Happy to share the issues if anyone cares.

--joel


> Craig
>
> > Thanks.
> >
> > --joel
> >
> >
> >
>
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.