]> git.ipfire.org Git - thirdparty/valgrind.git/commitdiff
Add test for stupid malloc etc args.
authorJulian Seward <jseward@acm.org>
Wed, 24 Apr 2002 11:44:27 +0000 (11:44 +0000)
committerJulian Seward <jseward@acm.org>
Wed, 24 Apr 2002 11:44:27 +0000 (11:44 +0000)
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@129

tests/Makefile.am
tests/malloc3.c [new file with mode: 0644]

index d122548585243c3c8b144e197243db1a9ff2567f..0f144e7ea2eef20484e1489c6539fbb8895b44c9 100644 (file)
@@ -23,4 +23,7 @@ EXTRA_DIST = \
        signal3.c smc1.c \
        suppfree.c tronical.c \
        tronical.s twoparams.c \
-       twoparams.s
\ No newline at end of file
+       twoparams.s \
+       pth_cvsimple.c pth_simple_threads.c pth_simple_mutex.c \
+       bt_everything.c bt_literal.c \
+       pth_threadpool.c pth_specific.c pth_mutexspeed.c malloc3.c
diff --git a/tests/malloc3.c b/tests/malloc3.c
new file mode 100644 (file)
index 0000000..896645c
--- /dev/null
@@ -0,0 +1,32 @@
+
+/* test of plausible behaviour with malloc and stupid args */
+
+#include <stdlib.h>
+#include <stdio.h>
+
+int main ( void )
+{
+  char* p;
+
+  p = malloc(0);
+  printf("malloc(0) = %p\n", p);
+  free(p);
+
+  p = malloc(-1);
+  printf("malloc(-1) = %p\n", p);
+  free(p);
+
+  p = calloc(0,1);
+  printf("calloc(0,1) = %p\n", p);
+  free(p);
+
+  p = calloc(0,-1);
+  printf("calloc(0,-1) = %p\n", p);
+  free(p);
+
+  p = calloc(-1,-1);
+  printf("calloc(-1,-1) = %p\n", p);
+  free(p);
+
+  return 0;
+}