[PATCH] D57230: [analyzer] Toning down invalidation a bit

Artem Dergachev via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon Mar 18 17:33:47 PDT 2019


NoQ added a comment.
Herald added a subscriber: Charusso.

Hmm, here's another one:

  struct ListInfo {
    struct ListInfo *next;
  };
  
  struct X {
    struct ListInfo li;
    int i;
  };
  
  void list_add(struct ListInfo *list, struct ListInfo *item);
  
  void foo(struct ListInfo *list) {
    struct X *x = malloc(sizeof(struct X));
    list_add(list, &x->li); // will free 'x'.
  }

People are C-style-inheriting from a list item base, and are then happy to release the memory through a pointer to a field. Now we're reporting a memory leak on such code.

It looks as if we should have somehow disabled //invalidation// but not //pointer escape// for the base region.


Repository:
  rL LLVM

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

https://reviews.llvm.org/D57230





More information about the cfe-commits mailing list