]> git.ipfire.org Git - thirdparty/glibc.git/commitdiff
Use xmalloc in tst-setcontext-fpscr.c (bug 19668).
authorJoseph Myers <joseph@codesourcery.com>
Tue, 6 Feb 2018 21:32:53 +0000 (21:32 +0000)
committerJoseph Myers <joseph@codesourcery.com>
Tue, 6 Feb 2018 21:32:53 +0000 (21:32 +0000)
Bug 19668 reports an unchecked malloc call in the test
sysdeps/powerpc/fpu/tst-setcontext-fpscr.c.  This patch makes that
test use xmalloc.  It does not otherwise move this test to the
support/ infrastructure or support/test-driver.c; the test has various
uses of exit and _exit on error cases, and uses atexit, and while I
think those things would all still work in the context of
test-driver.c, it's not an immediately obvious conversion the way it
would be for many tests that don't use test-driver.c.

Tested for powerpc.

[BZ #19668]
* sysdeps/powerpc/fpu/tst-setcontext-fpscr.c: Include
<support/support.h>.  Do not include <malloc.h>.
(query_auxv): Use xmalloc instead of malloc.

ChangeLog
sysdeps/powerpc/fpu/tst-setcontext-fpscr.c

index c9734c46b67502c5d0a829b4a7143d73db813c59..ca14746ce6a939889a6290feb1c3356d53c1aaba 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,10 @@
 2018-02-06  Joseph Myers  <joseph@codesourcery.com>
 
+       [BZ #19668]
+       * sysdeps/powerpc/fpu/tst-setcontext-fpscr.c: Include
+       <support/support.h>.  Do not include <malloc.h>.
+       (query_auxv): Use xmalloc instead of malloc.
+
        [BZ #14553]
        * posix/sys/types.h (loff_t): Only define for [__USE_MISC].
        * sysdeps/unix/sysv/linux/sys/quota.h (dqoff): Use __loff_t
index c64ca88a85e83774a35de91c97bd5ceb6e225178..4b25ec3e4005d9b87abcb418887ce243f91ba14a 100644 (file)
 #include <string.h>
 #include <ucontext.h>
 #include <unistd.h>
-#include <malloc.h>
 #include <link.h>
 #include <elf.h>
 #include <fpu_control.h>
 #include <sys/auxv.h>
+#include <support/support.h>
 
 static ucontext_t ctx[3];
 
@@ -59,7 +59,7 @@ ElfW(Addr) query_auxv(int type)
          perror("Error opening file for reading");
          return 0;
        }
-      auxv = (ElfW(auxv_t) *)malloc(getpagesize());
+      auxv = xmalloc (getpagesize ());
 
       do
        {