Do we care about malloc failure in tests?

Mike Frysinger vapier@gentoo.org
Tue May 31 22:11:00 GMT 2016


On 30 May 2016 15:44, Paul Pluzhnikov wrote:
> We have a few bugs opened by Bill, e.g.: BZ #19672, BZ #19668
> complaining about this pattern in tests:
> 
>   char *p = malloc(20);
>   p[0] = '\0';  // did not check against NULL.
> 
> I spot-checked other existing tests:
> 
> libio/tst-atime.c
> libio/tst-fopenloc.c
> libio/tst-ftell-partial-wide.c
> libio/tst-mmap2-eofsync.c
> 
> Two of them check for NULL, and two do not.
> 
> Do we have a policy here?
> Should I fix them to consistently check for NULL, or delete existing
> NULL checks?

i'd really like to see xmalloc type helpers added to the test skeleton
rather than change every test to include the same boiler plate
-mike
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: Digital signature
URL: <http://sourceware.org/pipermail/libc-alpha/attachments/20160531/b76d1077/attachment.sig>


More information about the Libc-alpha mailing list