This is the mail archive of the
libc-alpha@sourceware.org
mailing list for the glibc project.
Use xmalloc in tst-setcontext-fpscr.c (bug 19668)
- From: Joseph Myers <joseph at codesourcery dot com>
- To: <libc-alpha at sourceware dot org>
- Date: Thu, 1 Feb 2018 20:37:24 +0000
- Subject: Use xmalloc in tst-setcontext-fpscr.c (bug 19668)
- Authentication-results: sourceware.org; auth=none
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.
2018-02-01 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.
diff --git a/sysdeps/powerpc/fpu/tst-setcontext-fpscr.c b/sysdeps/powerpc/fpu/tst-setcontext-fpscr.c
index c64ca88..f39f1c4 100644
--- a/sysdeps/powerpc/fpu/tst-setcontext-fpscr.c
+++ b/sysdeps/powerpc/fpu/tst-setcontext-fpscr.c
@@ -23,11 +23,11 @@
#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 = (ElfW(auxv_t) *) xmalloc (getpagesize ());
do
{
--
Joseph S. Myers
joseph@codesourcery.com