diff --git a/clang/lib/StaticAnalyzer/Checkers/MallocChecker.cpp b/clang/lib/StaticAnalyzer/Checkers/MallocChecker.cpp --- a/clang/lib/StaticAnalyzer/Checkers/MallocChecker.cpp +++ b/clang/lib/StaticAnalyzer/Checkers/MallocChecker.cpp @@ -2471,7 +2471,8 @@ categories::MemoryError)); auto R = std::make_unique( - *BT_UseZerroAllocated[*CheckKind], "Use of zero-allocated memory", N); + *BT_UseZerroAllocated[*CheckKind], + "Use of memory allocated with size zero", N); R->addRange(Range); if (Sym) { diff --git a/clang/test/Analysis/NewDelete-checker-test.cpp b/clang/test/Analysis/NewDelete-checker-test.cpp --- a/clang/test/Analysis/NewDelete-checker-test.cpp +++ b/clang/test/Analysis/NewDelete-checker-test.cpp @@ -105,13 +105,13 @@ void testUseZeroAlloc1() { int *p = (int *)operator new(0); - *p = 1; // newdelete-warning {{Use of zero-allocated memory}} + *p = 1; // newdelete-warning {{Use of memory allocated with size zero}} delete p; } int testUseZeroAlloc2() { int *p = (int *)operator new[](0); - return p[0]; // newdelete-warning {{Use of zero-allocated memory}} + return p[0]; // newdelete-warning {{Use of memory allocated with size zero}} delete[] p; } @@ -119,7 +119,7 @@ void testUseZeroAlloc3() { int *p = new int[0]; - f(*p); // newdelete-warning {{Use of zero-allocated memory}} + f(*p); // newdelete-warning {{Use of memory allocated with size zero}} delete[] p; } diff --git a/clang/test/Analysis/malloc.c b/clang/test/Analysis/malloc.c --- a/clang/test/Analysis/malloc.c +++ b/clang/test/Analysis/malloc.c @@ -261,23 +261,23 @@ void CheckUseZeroAllocated1() { int *p = malloc(0); - *p = 1; // expected-warning {{Use of zero-allocated memory}} + *p = 1; // expected-warning {{Use of memory allocated with size zero}} free(p); } char CheckUseZeroAllocated2() { char *p = alloca(0); - return *p; // expected-warning {{Use of zero-allocated memory}} + return *p; // expected-warning {{Use of memory allocated with size zero}} } char CheckUseZeroWinAllocated2() { char *p = _alloca(0); - return *p; // expected-warning {{Use of zero-allocated memory}} + return *p; // expected-warning {{Use of memory allocated with size zero}} } void UseZeroAllocated(int *p) { if (p) - *p = 7; // expected-warning {{Use of zero-allocated memory}} + *p = 7; // expected-warning {{Use of memory allocated with size zero}} } void CheckUseZeroAllocated3() { int *p = malloc(0); @@ -287,39 +287,39 @@ void f(char); void CheckUseZeroAllocated4() { char *p = valloc(0); - f(*p); // expected-warning {{Use of zero-allocated memory}} + f(*p); // expected-warning {{Use of memory allocated with size zero}} free(p); } void CheckUseZeroAllocated5() { int *p = calloc(0, 2); - *p = 1; // expected-warning {{Use of zero-allocated memory}} + *p = 1; // expected-warning {{Use of memory allocated with size zero}} free(p); } void CheckUseZeroAllocated6() { int *p = calloc(2, 0); - *p = 1; // expected-warning {{Use of zero-allocated memory}} + *p = 1; // expected-warning {{Use of memory allocated with size zero}} free(p); } void CheckUseZeroAllocated7() { int *p = realloc(0, 0); - *p = 1; // expected-warning {{Use of zero-allocated memory}} + *p = 1; // expected-warning {{Use of memory allocated with size zero}} free(p); } void CheckUseZeroAllocated8() { int *p = malloc(8); int *q = realloc(p, 0); - *q = 1; // expected-warning {{Use of zero-allocated memory}} + *q = 1; // expected-warning {{Use of memory allocated with size zero}} free(q); } void CheckUseZeroAllocated9() { int *p = realloc(0, 0); int *q = realloc(p, 0); - *q = 1; // expected-warning {{Use of zero-allocated memory}} + *q = 1; // expected-warning {{Use of memory allocated with size zero}} free(q); } @@ -344,7 +344,7 @@ char *p = malloc(s); if (b) - *p = 1; // expected-warning {{Use of zero-allocated memory}} + *p = 1; // expected-warning {{Use of memory allocated with size zero}} free(p); } @@ -372,7 +372,7 @@ char *q = realloc(p, s); if (b) - *q = 1; // expected-warning {{Use of zero-allocated memory}} + *q = 1; // expected-warning {{Use of memory allocated with size zero}} free(q); }