[all-commits] [llvm/llvm-project] bce1cc: [analyzer] Teach MismatchedDealloc about initWithB...

NoQ via All-commits all-commits at lists.llvm.org
Wed Dec 18 14:19:24 PST 2019


  Branch: refs/heads/master
  Home:   https://github.com/llvm/llvm-project
  Commit: bce1cce6bf1286541c57690ab1129fbc02c60f93
      https://github.com/llvm/llvm-project/commit/bce1cce6bf1286541c57690ab1129fbc02c60f93
  Author: Artem Dergachev <artem.dergachev at gmail.com>
  Date:   2019-12-18 (Wed, 18 Dec 2019)

  Changed paths:
    M clang/lib/StaticAnalyzer/Checkers/MallocChecker.cpp
    M clang/test/Analysis/Inputs/system-header-simulator-objc.h
    M clang/test/Analysis/malloc.mm

  Log Message:
  -----------
  [analyzer] Teach MismatchedDealloc about initWithBytesNoCopy with deallocator.

MallocChecker warns when memory is passed into -[NSData initWithBytesNoCopy]
but isn't allocated by malloc(), because it will be deallocated by free().
However, initWithBytesNoCopy has an overload that takes an arbitrary block
for deallocating the object. If such overload is used, it is no longer
necessary to make sure that the memory is allocated by malloc().




More information about the All-commits mailing list