Commit graph

2 commits

Author SHA1 Message Date
Caroline Tice
24340057e9 Eliminate false positive static analyzer warnings.
The compiler static analyzer is issuing several false positive
warnings for the file system/core/libadf/adf.cpp:
line 134: warning: Attempt to free released memory
line 240: warning: Use of memory after it is freed
line 454: warning: Use of memory after it is freed
line 553: warning: Attempt to free released memory
line 568: warning: Use of memory after it is freed
line 645: warning: Potential leak of memory pointed to by 'engs'
line 653: warning: Potential leak of memory pointed to by 'filtered_engs'

After careful analysis of the source I have come to the conclusion
that these are false warnings.  This CL annotates the source so the
static analyzer won't issue these warnings any more.

Bug: None
Test: The warnings are no longer being issued.
Change-Id: I158756b3f1eeb66f346be3cd2ffe10ebde236c80
2017-09-26 15:27:37 -07:00
Greg Hackmann
dc80973726 libadf: convert to C++
Both humans and the clang static analyzer find libadf's error handling
confusing.

Now that the platform has better C++ support, we can clean up things up
by switching to C++ and using STL + RAII in targeted parts of the code.
This isn't a complete rewrite in idiomatic C++, but it's enough to get
rid of all the "goto" statements (and the false-positive memory leaks
found by clang's static analyzer).

Bug: 27125399

Test: WITH_STATIC_ANALYZER=1 mmm system/core/adf/libadf
Test: /data/nativetest/adf-unit-tests/adf-unit-tests (on Nexus 9)
Test: /data/nativetest64/adf-unit-tests/adf-unit-tests (on Nexus 9)
Change-Id: Ie9dd5d5dc424d1a3ddcc3cba836fce04190f46fd
Signed-off-by: Greg Hackmann <ghackmann@google.com>
2017-02-22 21:18:48 +00:00
Renamed from adf/libadf/adf.c (Browse further)