1
0
mirror of https://sourceware.org/git/glibc.git synced 2025-07-29 11:41:21 +03:00

Move string/testcopy.c to test-driver.c and xmalloc (bug 19667).

Bug 19667 reports unchecked malloc calls in the test
string/testcopy.c.  This patch makes that test use xmalloc and the
support/test-driver.c test framework.

Tested for x86_64.

	[BZ #19667]
	* string/testcopy.c: Include <support/support.h>.  Do not include
	<malloc.h>.  Use <support/test-driver.c>.
	(main): Rename to do_test.  Make static.  Use xmalloc instead of
	malloc.
This commit is contained in:
Joseph Myers
2018-02-06 21:43:20 +00:00
parent 625fb764b4
commit d92c275997
2 changed files with 15 additions and 7 deletions

View File

@ -1,5 +1,11 @@
2018-02-06 Joseph Myers <joseph@codesourcery.com> 2018-02-06 Joseph Myers <joseph@codesourcery.com>
[BZ #19667]
* string/testcopy.c: Include <support/support.h>. Do not include
<malloc.h>. Use <support/test-driver.c>.
(main): Rename to do_test. Make static. Use xmalloc instead of
malloc.
[BZ #13575] [BZ #13575]
* posix/bits/posix1_lim.h: Include <bits/wordsize.h>. * posix/bits/posix1_lim.h: Include <bits/wordsize.h>.
[!SSIZE_MAX && !(__WORDSIZE == 64 || __WORDSIZE32_SIZE_ULONG)] [!SSIZE_MAX && !(__WORDSIZE == 64 || __WORDSIZE32_SIZE_ULONG)]

View File

@ -19,10 +19,10 @@
#include <stdlib.h> #include <stdlib.h>
#include <stdio.h> #include <stdio.h>
#include <string.h> #include <string.h>
#include <malloc.h> #include <support/support.h>
int static int
main (void) do_test (void)
{ {
char *mem, *memp; char *mem, *memp;
char *rand_mem; char *rand_mem;
@ -34,10 +34,10 @@ main (void)
max_size = 256; max_size = 256;
mem = malloc (max_size + 2 * max_size + 2 * space_around); mem = xmalloc (max_size + 2 * max_size + 2 * space_around);
rand_mem = malloc (max_size); rand_mem = xmalloc (max_size);
lo_around = malloc (space_around); lo_around = xmalloc (space_around);
hi_around = malloc (space_around); hi_around = xmalloc (space_around);
memp = mem + space_around; memp = mem + space_around;
/* Fill RAND_MEM with random bytes, each non-zero. */ /* Fill RAND_MEM with random bytes, each non-zero. */
@ -105,3 +105,5 @@ main (void)
return 0; return 0;
} }
#include <support/test-driver.c>