[PATCH] D70470: [analyzer] Add FuchsiaHandleCheck to catch handle leaks, use after frees and double frees

Artem Dergachev via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon Dec 2 13:48:47 PST 2019


NoQ added a comment.

> I feel like the 2. is a better solution. Of course, that change might have a performance impact as well.

Yes, i'm all for '2.'. There's no need to make this callback more complicated than it already is.

As for performance, it's messy and suffers from a deeper problem: the number of escaped symbols is potentially infinite. The following false positive illustrates that well:

  void invalidate(int **x);
  
  void foo(int **x) {
    int *y = *x;
    if (*y == 0) {
      // **x should be invalidated here!
      invalidate(x);
    }
    // Should not warn about division by zero!
    1 / *y;
  }

Therefore one does not simply compose a list of escaped symbols. We need something similar to `SymbolReaper` but for invalidation/escapes. And //then// we'll talk about performance.


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D70470/new/

https://reviews.llvm.org/D70470





More information about the cfe-commits mailing list