[PATCH] D13488: [analyzer] Assume escape is possible through system functions taking void*

Anna Zaks via cfe-commits cfe-commits at lists.llvm.org
Tue Oct 6 16:47:43 PDT 2015


zaks.anna created this revision.
zaks.anna added a reviewer: dcoughlin.
zaks.anna added subscribers: xazax.hun, cfe-commits.
Herald added a subscriber: aemerson.

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.

http://reviews.llvm.org/D13488

Files:
  include/clang/StaticAnalyzer/Core/PathSensitive/CallEvent.h
  lib/StaticAnalyzer/Checkers/MallocChecker.cpp
  lib/StaticAnalyzer/Core/CallEvent.cpp
  test/Analysis/Inputs/system-header-simulator.h
  test/Analysis/malloc.c

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D13488.36679.patch
Type: text/x-patch
Size: 5756 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20151006/7738ee1c/attachment.bin>


More information about the cfe-commits mailing list