[analyzer] Fix another false positive in malloc realloc logic.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@163749 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/test/Analysis/malloc.c b/test/Analysis/malloc.c
index 52a7924..b939ac3 100644
--- a/test/Analysis/malloc.c
+++ b/test/Analysis/malloc.c
@@ -1020,6 +1020,16 @@
return 0;
}
+// Test realloc with no visible malloc.
+void *test(void *ptr) {
+ void *newPtr = realloc(ptr, 4);
+ if (newPtr == 0) {
+ if (ptr)
+ free(ptr); // no-warning
+ }
+ return newPtr;
+}
+
// ----------------------------------------------------------------------------
// False negatives.