diff options
| author | Anna Zaks <ganna@apple.com> | 2015-10-27 20:19:45 +0000 |
|---|---|---|
| committer | Anna Zaks <ganna@apple.com> | 2015-10-27 20:19:45 +0000 |
| commit | fe1eca516988c2e79378e833b1cbde1a2907d042 (patch) | |
| tree | fb8fb86c4889a5d386b2f008308b6fbcd7fd10e4 /clang/test/Analysis/Inputs | |
| parent | ac98dbc33ba4d510700b4235cb4007ed94247515 (diff) | |
| download | bcm5719-llvm-fe1eca516988c2e79378e833b1cbde1a2907d042.tar.gz bcm5719-llvm-fe1eca516988c2e79378e833b1cbde1a2907d042.zip | |
[analyzer] Assume escape is possible through system functions taking void*
The analyzer assumes that system functions will not free memory or modify the
arguments in other ways, so we assume that arguments do not escape when
those are called. However, this may lead to false positive leak errors. For
example, in code like this where the pointers added to the rb_tree are freed
later on:
struct alarm_event *e = calloc(1, sizeof(*e));
<snip>
rb_tree_insert_node(&alarm_tree, e);
Add a heuristic to assume that calls to system functions taking void*
arguments allow for pointer escape.
llvm-svn: 251449
Diffstat (limited to 'clang/test/Analysis/Inputs')
| -rw-r--r-- | clang/test/Analysis/Inputs/system-header-simulator.h | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/clang/test/Analysis/Inputs/system-header-simulator.h b/clang/test/Analysis/Inputs/system-header-simulator.h index 8b8c9c4fe17..8605a2cbcb3 100644 --- a/clang/test/Analysis/Inputs/system-header-simulator.h +++ b/clang/test/Analysis/Inputs/system-header-simulator.h @@ -82,6 +82,12 @@ void xpc_connection_resume(xpc_connection_t connection); void fakeSystemHeaderCallInt(int *); void fakeSystemHeaderCallIntPtr(int **); +// Some data strauctures may hold onto the pointer and free it later. +void fake_insque(void *, void *); +typedef struct fake_rb_tree { void *opaque[8]; } fake_rb_tree_t; +void fake_rb_tree_init(fake_rb_tree_t *, const void *); +void *fake_rb_tree_insert_node(fake_rb_tree_t *, void *); + typedef struct __SomeStruct { char * p; } SomeStruct; |

