reference, declaration → definition definition → references, declarations, derived classes, virtual overrides reference to multiple definitions → definitions unreferenced |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 | void test() { int *p = malloc(1); free(p); free(p); // warn: attempt to free released memory } void test() { int *p = malloc(sizeof(int)); free(p); *p = 1; // warn: use after free } void test() { int *p = malloc(1); if (p) return; // warn: memory is never released } void test() { int a[] = { 1 }; free(a); // warn: argument is not allocated by malloc } void test() { int *p = malloc(sizeof(char)); p = p - 1; free(p); // warn: argument to free() is offset by -4 bytes } |