malloc3.c revision aed053675acc9fb4fcbe7bc38c1120317bad68fa
1 2/* test of plausible behaviour with malloc and stupid args */ 3 4#include <stdlib.h> 5#include <stdio.h> 6 7int main ( void ) 8{ 9 char* p; 10 11 p = malloc(0); 12 printf("malloc(0) = 0x%lx\n", (unsigned long)p); 13 free(p); 14 15 p = malloc(-1); 16 printf("malloc(-1) = 0x%lx\n", (unsigned long)p); 17 free(p); 18 19 p = calloc(0,1); 20 printf("calloc(0,1) = 0x%lx\n", (unsigned long)p); 21 free(p); 22 23 p = calloc(0,-1); 24 printf("calloc(0,-1) = 0x%lx\n", (unsigned long)p); 25 free(p); 26 27 p = calloc(-1,-1); 28 printf("calloc(-1,-1) = 0x%lx\n", (unsigned long)p); 29 free(p); 30 31 return 0; 32} 33