Suppress a static-analyzer warning

Our analyzer was flagging this as a memory leak, since it saw that we
were `strdup`ing into the mData member of this AString temporary:

frameworks/av/media/libstagefright/foundation/AString.cpp:368:5:
warning: Potential leak of memory pointed to by field 'mData'
[clang-analyzer-unix.Malloc]

This is incorrect, and appears to be related to LLVM PR38176.

Add a NOLINT until it's fixed upstream.

Bug: 120788908
Test: Ran the analyzer
Change-Id: Iaee20a740d721010862d2cce51383bdae311bd0a
gugelfrei
George Burgess IV 6 years ago
parent f3209f65de
commit f82a6c36da

@ -365,6 +365,8 @@ bool AString::endsWithIgnoreCase(const char *suffix) const {
// static
AString AString::FromParcel(const Parcel &parcel) {
size_t size = static_cast<size_t>(parcel.readInt32());
// The static analyzer incorrectly reports a false-positive here in c++17.
// https://bugs.llvm.org/show_bug.cgi?id=38176 . NOLINTNEXTLINE
return AString(static_cast<const char *>(parcel.readInplace(size)), size);
}

Loading…
Cancel
Save