From 7737a448cf97cf21f341d64fa5ef5c49d3142f73 Mon Sep 17 00:00:00 2001 From: versat Date: Mon, 9 Sep 2019 15:02:55 +0200 Subject: [PATCH] Fix #9345 FP wrongPrintfScanfArgNum for vasprintf Configuration "" for function is wrong, for the argument it is fine. --- cfg/gnu.cfg | 4 ++-- test/cfg/gnu.c | 8 +++++++- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/cfg/gnu.cfg b/cfg/gnu.cfg index 9334e8d8d..339e1d99c 100644 --- a/cfg/gnu.cfg +++ b/cfg/gnu.cfg @@ -351,13 +351,13 @@ - - + + diff --git a/test/cfg/gnu.c b/test/cfg/gnu.c index 0b942d9b8..67995f7b7 100644 --- a/test/cfg/gnu.c +++ b/test/cfg/gnu.c @@ -11,6 +11,7 @@ #include #include #include +#include #include #ifndef __CYGWIN__ #include @@ -87,7 +88,7 @@ int no_resourceLeak_mkostemp_02(char *template, int flags) return mkostemp(template, flags); } -void valid_code(int argInt1) +void valid_code(int argInt1, va_list valist_arg) { char *p; @@ -111,6 +112,11 @@ void valid_code(int argInt1) __builtin_prefetch(p, 0, 1); if (__builtin_types_compatible_p(int, char)) {} + + char * pStr = NULL; + if (vasprintf(&pStr, "%d %d", valist_arg) != -1) { + free(pStr); + } } void ignoreleak(void)