source:
CIVL/examples/memleak/heapleak.c
| Last change on this file was 61c7ca6, checked in by , 3 years ago | |
|---|---|
|
|
| File size: 244 bytes | |
| Line | |
|---|---|
| 1 | #include <stdlib.h> |
| 2 | #include <assert.h> |
| 3 | #include <stdio.h> |
| 4 | struct S { |
| 5 | struct S * fld; |
| 6 | }; |
| 7 | int main() { |
| 8 | struct S *p = malloc(sizeof(struct S)); |
| 9 | p->fld = p; |
| 10 | p = NULL; |
| 11 | // memory leak should be reported now |
| 12 | while (1) { printf("hi"); } |
| 13 | } |
Note:
See TracBrowser
for help on using the repository browser.
