diff options
author | Ranjith Kumaran <ranjith@cygnus.com> | 2000-03-17 22:48:54 +0000 |
---|---|---|
committer | Ranjith Kumaran <ranjith@cygnus.com> | 2000-03-17 22:48:54 +0000 |
commit | 03261851a10dd2d6900a0a00a7515a0a46fb5d76 (patch) | |
tree | 7c22ac6cbbc99fd5cd1b5426853be8d4fd7bfcf1 /libgloss/testsuite/libgloss.all/memory.c | |
parent | fae4c299f14fc23e2829c8656992eba21f79242a (diff) | |
download | cygnal-03261851a10dd2d6900a0a00a7515a0a46fb5d76.tar.gz cygnal-03261851a10dd2d6900a0a00a7515a0a46fb5d76.tar.bz2 cygnal-03261851a10dd2d6900a0a00a7515a0a46fb5d76.zip |
20000317 sourceware import
Diffstat (limited to 'libgloss/testsuite/libgloss.all/memory.c')
-rw-r--r-- | libgloss/testsuite/libgloss.all/memory.c | 38 |
1 files changed, 38 insertions, 0 deletions
diff --git a/libgloss/testsuite/libgloss.all/memory.c b/libgloss/testsuite/libgloss.all/memory.c new file mode 100644 index 000000000..6e0422d3d --- /dev/null +++ b/libgloss/testsuite/libgloss.all/memory.c @@ -0,0 +1,38 @@ +/* WinBond bug report + + malloc() returns 0x0. + + test the memory calls. These test sbrk(), which is part of glue.c + for most architectures. + */ + +#include <stdio.h> +#define BUFSIZE 80 + +main() +{ + char *buf; + char *tmp; + char *result; + + /* see if we can get some memory */ + buf = (char *)malloc(BUFSIZE); + if (buf != 0x0) { + pass ("malloc"); + } else { + fail ("malloc"); + } + + /* see if we can realloc it */ + tmp = buf; + result = (char *)realloc (buf, BUFSIZE+100); + if ((buf != 0x0) && (result != 0x0)) { + pass ("realloc"); + } else { + fail ("realloc"); + } + + /* see if we can free it up. FIXME: how to test free ?*/ + free (buf); + fflush (stdout); +} |