[PATCH] D94640: adds more checks to -Wfree-nonheap-object

Nico Weber via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Fri Feb 26 08:56:45 PST 2021


thakis added a comment.

This seems to flag https://source.chromium.org/chromium/chromium/src/+/master:third_party/libsync/src/sync.c;l=142?q=sync.c&ss=chromium :

  info->sync_fence_info = (uint64_t) calloc(num_fences,
                                  sizeof(struct sync_fence_info));
  if ((void *)info->sync_fence_info == NULL)
      goto free;
  
  err = ioctl(fd, SYNC_IOC_FILE_INFO, info);
  if (err < 0) {
      free((void *)info->sync_fence_info);
      goto free;
  }

What's the motivation for flagging an integer that's >= sizeof(void*) and that's explicitly cast to void*? That seems like code that's pretty explicit about its intentions.

Did you do true positive / false positive evaluation of this change?


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D94640



More information about the cfe-commits mailing list