summaryrefslogtreecommitdiffstats
path: root/clang/test/Analysis/malloc.c
diff options
context:
space:
mode:
Diffstat (limited to 'clang/test/Analysis/malloc.c')
-rw-r--r--clang/test/Analysis/malloc.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/clang/test/Analysis/malloc.c b/clang/test/Analysis/malloc.c
index a38c30a5ed6..1923305fe20 100644
--- a/clang/test/Analysis/malloc.c
+++ b/clang/test/Analysis/malloc.c
@@ -671,6 +671,12 @@ int testStrndup(const char *s, unsigned validIndex, unsigned size) {
return 1;// expected-warning {{Memory is never released; potential memory leak}}
}
+void testStrdupContentIsDefined(const char *s, unsigned validIndex) {
+ char *s2 = strdup(s);
+ char result = s2[1];// no warning
+ free(s2);
+}
+
// Below are the known false positives.
// TODO: There should be no warning here. This one might be difficult to get rid of.
OpenPOWER on IntegriCloud