summaryrefslogtreecommitdiffstats
path: root/clang/test/Analysis/MismatchedDeallocator-checker-test.mm
diff options
context:
space:
mode:
Diffstat (limited to 'clang/test/Analysis/MismatchedDeallocator-checker-test.mm')
-rw-r--r--clang/test/Analysis/MismatchedDeallocator-checker-test.mm11
1 files changed, 2 insertions, 9 deletions
diff --git a/clang/test/Analysis/MismatchedDeallocator-checker-test.mm b/clang/test/Analysis/MismatchedDeallocator-checker-test.mm
index 3cc3e18c7c7..15815e80bfa 100644
--- a/clang/test/Analysis/MismatchedDeallocator-checker-test.mm
+++ b/clang/test/Analysis/MismatchedDeallocator-checker-test.mm
@@ -95,11 +95,8 @@ void testNew6() {
realloc(p, sizeof(long)); // expected-warning{{Memory allocated by 'new[]' should be deallocated by 'delete[]', not realloc()}}
}
-int *allocInt() {
- return new int;
-}
void testNew7() {
- int *p = allocInt();
+ int *p = new int;
delete[] p; // expected-warning{{Memory allocated by 'new' should be deallocated by 'delete', not 'delete[]'}}
}
@@ -108,12 +105,8 @@ void testNew8() {
delete[] p; // expected-warning{{Memory allocated by operator new should be deallocated by 'delete', not 'delete[]'}}
}
-int *allocIntArray(unsigned c) {
- return new int[c];
-}
-
void testNew9() {
- int *p = allocIntArray(1);
+ int *p = new int[1];
delete p; // expected-warning{{Memory allocated by 'new[]' should be deallocated by 'delete[]', not 'delete'}}
}
OpenPOWER on IntegriCloud