sewardj | 3059442 | 2002-04-24 11:44:27 +0000 | [diff] [blame] | 1 | |
| 2 | /* test of plausible behaviour with malloc and stupid args */ |
| 3 | |
| 4 | #include <stdlib.h> |
| 5 | #include <stdio.h> |
| 6 | |
| 7 | int main ( void ) |
| 8 | { |
| 9 | char* p; |
| 10 | |
| 11 | p = malloc(0); |
| 12 | printf("malloc(0) = %p\n", p); |
| 13 | free(p); |
| 14 | |
| 15 | p = malloc(-1); |
| 16 | printf("malloc(-1) = %p\n", p); |
| 17 | free(p); |
| 18 | |
| 19 | p = calloc(0,1); |
| 20 | printf("calloc(0,1) = %p\n", p); |
| 21 | free(p); |
| 22 | |
| 23 | p = calloc(0,-1); |
| 24 | printf("calloc(0,-1) = %p\n", p); |
| 25 | free(p); |
| 26 | |
| 27 | p = calloc(-1,-1); |
| 28 | printf("calloc(-1,-1) = %p\n", p); |
| 29 | free(p); |
| 30 | |
| 31 | return 0; |
| 32 | } |