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