[PATCH] D20863: [analyzer] Fix for the strdup family in unix.malloc checker

Balogh, Ádám via cfe-commits cfe-commits at lists.llvm.org
Wed Jun 1 06:54:34 PDT 2016


baloghadamsoftware created this revision.
baloghadamsoftware added a reviewer: dcoughlin.
baloghadamsoftware added subscribers: cfe-commits, xazax.hun, o.gyorgy.

The strdup family was only partially handled in the original checker. As a consequence it did not recognize leaks where a variable which received a result of an strdup was later overwritten. (The unix.cstring checkers did not recognize this leak either, but their task is also different.) This patch fixes this issue by simulating the memory allocation of strdup functions. Some new functions where taken from the unix.cstring checkers but they were also simplified and adapted for the purpose of the checker. Some other tests had to be fixed as well since they contained strdup caused memory leaks. (The leak was not fixed but the warning is now expected.)

http://reviews.llvm.org/D20863

Files:
  lib/StaticAnalyzer/Checkers/MallocChecker.cpp
  test/Analysis/malloc.c
  test/Analysis/pr22954.c
  test/Analysis/unions.cpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D20863.59217.patch
Type: text/x-patch
Size: 11328 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20160601/de57dc5f/attachment.bin>


More information about the cfe-commits mailing list