diff options
Diffstat (limited to 'test/Analysis/malloc.c')
-rw-r--r-- | test/Analysis/malloc.c | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/test/Analysis/malloc.c b/test/Analysis/malloc.c index 52a79243ce..b939ac36d1 100644 --- a/test/Analysis/malloc.c +++ b/test/Analysis/malloc.c @@ -1020,6 +1020,16 @@ int reallocButNoMallocPR13674(struct HasPtr *a, int c, int size) { 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. |