source:
CIVL/examples/languageFeatures/mallocBad3.cvl@
b50d2e7
| Last change on this file since b50d2e7 was 36b5ada, checked in by , 12 years ago | |
|---|---|
|
|
| File size: 267 bytes | |
| Line | |
|---|---|
| 1 | /* Commandline execution: |
| 2 | * civl verify mallocBad3.cvl |
| 3 | * */ |
| 4 | #include <civlc.h> |
| 5 | void main() { |
| 6 | $heap h, h0; |
| 7 | double *p = (double *) $malloc(&h, 5*sizeof(double)); |
| 8 | |
| 9 | p[4]=3.14; |
| 10 | $assert(p[4]==3.14); |
| 11 | // Free pointer from the wrong heap. |
| 12 | $free(&h0, p); |
| 13 | } |
Note:
See TracBrowser
for help on using the repository browser.
