malloc.c revision ba93087ebd43c0f7b3e980dc9e49a9313d9c9f01
1// RUN: clang-cc -analyze -analyzer-experimental-internal-checks -checker-cfref -analyzer-experimental-checks -analyzer-store=region -verify %s
2#include <stdlib.h>
3
4void f1() {
5  int *p = malloc(10);
6  return; // expected-warning{{Allocated memory never released. Potential memory leak.}}
7}
8
9// THIS TEST CURRENTLY FAILS.
10void f1_b() {
11  int *p = malloc(10);
12}
13
14void f2() {
15  int *p = malloc(10);
16  free(p);
17  free(p); // expected-warning{{Try to free a memory block that has been released}}
18}
19