source:
CIVL/examples/languageFeatures/mallocBad3.cvl@
13ac9574
| Last change on this file since 13ac9574 was 36b5ada, checked in by , 12 years ago | |
|---|---|
|
|
| File size: 267 bytes | |
| Rev | Line | |
|---|---|---|
| [36b5ada] | 1 | /* Commandline execution: |
| 2 | * civl verify mallocBad3.cvl | |
| 3 | * */ | |
| [1f192b0] | 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); | |
| [36b5ada] | 11 | // Free pointer from the wrong heap. |
| [1f192b0] | 12 | $free(&h0, p); |
| 13 | } |
Note:
See TracBrowser
for help on using the repository browser.
