[PATCH] D133119: [clang-tidy] Add checker 'bugprone-suspicious-realloc-usage'.
Balázs Benics via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Thu Sep 29 08:51:11 PDT 2022
steakhal accepted this revision.
steakhal added a comment.
LGTM, no objection here.
================
Comment at: clang-tools-extra/test/clang-tidy/checkers/bugprone/suspicious-realloc-usage.cpp:81-85
+void warn_if_copy_exists(void *p) {
+ void *q = p;
+ p = realloc(p, 111);
+ // CHECK-MESSAGES: :[[@LINE-1]]:7: warning: 'p' may be set to null if 'realloc' fails, which may result in a leak of the original buffer [bugprone-suspicious-realloc-usage]
+}
----------------
I believe we should also put a FIXME here.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D133119/new/
https://reviews.llvm.org/D133119
More information about the cfe-commits
mailing list