summaryrefslogtreecommitdiffstats
path: root/clang/test/Analysis/malloc.c
diff options
context:
space:
mode:
authorJordan Rose <jordan_rose@apple.com>2012-07-02 19:27:51 +0000
committerJordan Rose <jordan_rose@apple.com>2012-07-02 19:27:51 +0000
commit7ab0182e33eee81dfc884e9cf95863bcaf30bab0 (patch)
tree4b90d6b3456902c203dbb741b2eac661d7ffa925 /clang/test/Analysis/malloc.c
parent2995349f3ea4ac46a864fdd3e822ea62a3847961 (diff)
downloadbcm5719-llvm-7ab0182e33eee81dfc884e9cf95863bcaf30bab0.tar.gz
bcm5719-llvm-7ab0182e33eee81dfc884e9cf95863bcaf30bab0.zip
[analyzer] Move the last bits of CallOrObjCMessage over to CallEvent.
This involved refactoring some common pointer-escapes code onto CallEvent, then having MallocChecker use those callbacks for whether or not to consider a pointer's /ownership/ as escaping. This still needs to be pinned down, and probably we want to make the new argumentsMayEscape() function a little more discerning (content invalidation vs. ownership/metadata invalidation), but this is a good improvement. As a bonus, also remove CallOrObjCMessage from the source completely. llvm-svn: 159557
Diffstat (limited to 'clang/test/Analysis/malloc.c')
-rw-r--r--clang/test/Analysis/malloc.c12
1 files changed, 12 insertions, 0 deletions
diff --git a/clang/test/Analysis/malloc.c b/clang/test/Analysis/malloc.c
index 9596751a0d6..377642cc58c 100644
--- a/clang/test/Analysis/malloc.c
+++ b/clang/test/Analysis/malloc.c
@@ -717,6 +717,18 @@ FILE *useFunOpenNoReleaseFunction() {
return f; // expected-warning{{leak}}
}
+static int readNothing(void *_ctx, char *buf, int size) {
+ return 0;
+}
+FILE *useFunOpenReadNoRelease() {
+ void *ctx = malloc(sizeof(int));
+ FILE *f = funopen(ctx, readNothing, 0, 0, 0);
+ if (f == 0) {
+ free(ctx);
+ }
+ return f; // expected-warning{{leak}}
+}
+
// Test setbuf, setvbuf.
int my_main_no_warning() {
char *p = malloc(100);
OpenPOWER on IntegriCloud