scandir leak patch
Mon Nov 24 20:44:00 GMT 2008
Joel Sherrill wrote:
> Attached is the current newlib scandir.c with
> the "goto cleanup_and_bail" modification from
> the RTEMS one plus an explicit check for 0
> entries from the fstat.
> How does this look?
> 2008-11-24 Joel Sherrill <firstname.lastname@example.org>
> * libc/posix/scandir.c: Fix memory leaks.
Thanks. I did some cleanup of your patch. First of all you should
have been using reallocf instead of realloc
since you reset the input pointer. Secondly I wasn't thrilled with the
cleanup_and_bail section occurring after the normal return so I added a
flag to indicate "if successful" and used it so there would only be the
one return statement. Let me know if I missed anything or whether you
have any problems with the modifications.
I have attached a new diff which would be applied to the original
-- Jeff J.
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
More information about the Newlib