]> granicus.if.org Git - clang/commitdiff
[analyzer] +Testcase: several used-after-free args passed to a function.
authorAnton Yartsev <anton.yartsev@gmail.com>
Wed, 10 Apr 2013 22:36:16 +0000 (22:36 +0000)
committerAnton Yartsev <anton.yartsev@gmail.com>
Wed, 10 Apr 2013 22:36:16 +0000 (22:36 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@179232 91177308-0d34-0410-b5e6-96231b3b80d8

test/Analysis/NewDelete-checker-test.cpp

index 35125ccc8f669d93487b015e8bf3a5e60914e654..9c838aad76fb322458f8f9271c17297b0a655b15 100644 (file)
@@ -114,6 +114,11 @@ void testUseLastArgAfterDelete(int *p) {
   f(0, 0, p); // expected-warning{{Use of memory after it is freed}}
 }
 
+void testUseSeveralArgsAfterDelete(int *p) {
+  delete p;
+  f(p, p, p); // expected-warning{{Use of memory after it is freed}}
+}
+
 void testUseRefArgAfterDelete(SomeClass &c) {
   delete &c;
   g(c); // expected-warning{{Use of memory after it is freed}}