sewardj | 99a2ceb | 2007-11-09 12:30:36 +0000 | [diff] [blame] | 1 | #include <stdlib.h> |
| 2 | |
| 3 | typedef struct |
| 4 | { |
| 5 | char *spointer1; |
| 6 | } structure; |
| 7 | |
| 8 | structure **func1(void) |
| 9 | { |
| 10 | |
| 11 | structure **pointer1 = 0; |
| 12 | |
| 13 | pointer1 = (structure **)malloc(4 * sizeof(structure *)); /* Line 13 */ |
| 14 | pointer1[1] = (structure *)malloc(sizeof(structure)); /* Line 14 */ |
| 15 | pointer1[1]->spointer1 = (char *)malloc(64); /* Line 15 */ |
| 16 | |
| 17 | return pointer1; |
| 18 | } |
| 19 | |
| 20 | int main(int argc, char *argv[]) |
| 21 | { |
| 22 | structure **pointer1 = func1(); |
| 23 | |
| 24 | free(pointer1); /* Leak reports Line 24 */ |
| 25 | |
| 26 | return 0; |
| 27 | } |