aboutsummaryrefslogtreecommitdiff
path: root/malloc/tst-malloc.c
diff options
context:
space:
mode:
authorUlrich Drepper <drepper@redhat.com>2006-08-24 17:30:37 +0000
committerUlrich Drepper <drepper@redhat.com>2006-08-24 17:30:37 +0000
commit7463d5cb4d42ffa944f05415f9d320b1b64d2bcf (patch)
tree5965915308653b2ce43950fc61101339c8149c1b /malloc/tst-malloc.c
parent542a6f62afe483fe282adaf60f5c0a185c12e824 (diff)
downloadglibc-7463d5cb4d42ffa944f05415f9d320b1b64d2bcf.zip
glibc-7463d5cb4d42ffa944f05415f9d320b1b64d2bcf.tar.gz
glibc-7463d5cb4d42ffa944f05415f9d320b1b64d2bcf.tar.bz2
* malloc/malloc.c (sYSMALLOc): Avoid infinite loop if MMAP
keeps failing and heap growth or new heap creation isn't successful either. * malloc/tst-malloc.c (main): Add new tests.
Diffstat (limited to 'malloc/tst-malloc.c')
-rw-r--r--malloc/tst-malloc.c12
1 files changed, 11 insertions, 1 deletions
diff --git a/malloc/tst-malloc.c b/malloc/tst-malloc.c
index d555ae4..81d2792 100644
--- a/malloc/tst-malloc.c
+++ b/malloc/tst-malloc.c
@@ -33,7 +33,7 @@ merror (const char *msg)
int
main (void)
{
- void *p;
+ void *p, *q;
int save;
errno = 0;
@@ -64,5 +64,15 @@ main (void)
if (p != NULL)
merror ("realloc (p, 0) failed.");
+ p = malloc (513 * 1024);
+ if (p == NULL)
+ merror ("malloc (513K) failed.");
+
+ q = malloc (-512 * 1024);
+ if (q != NULL)
+ merror ("malloc (-512K) succeeded.");
+
+ free (p);
+
return errors != 0;
}