From 3444b115ba5006b520ee661a8815aab85b835fd9 Mon Sep 17 00:00:00 2001 From: Sean Parkinson Date: Mon, 10 Aug 2020 13:15:20 +1000 Subject: [PATCH] Fix valgrind check to ignore bash leak --- Makefile.am | 1 + valgrind-bash.supp | 8 ++++++++ valgrind-error.sh | 10 ++++++---- 3 files changed, 15 insertions(+), 4 deletions(-) create mode 100644 valgrind-bash.supp diff --git a/Makefile.am b/Makefile.am index 1ef320fc5..60a5a57ae 100644 --- a/Makefile.am +++ b/Makefile.am @@ -135,6 +135,7 @@ EXTRA_DIST+= wolfssl-ntru.sln EXTRA_DIST+= wolfssl.sln EXTRA_DIST+= wolfssl64.sln EXTRA_DIST+= valgrind-error.sh +EXTRA_DIST+= valgrind-bash.supp EXTRA_DIST+= fips-hash.sh EXTRA_DIST+= gencertbuf.pl EXTRA_DIST+= README.md diff --git a/valgrind-bash.supp b/valgrind-bash.supp new file mode 100644 index 000000000..87c9e499d --- /dev/null +++ b/valgrind-bash.supp @@ -0,0 +1,8 @@ +{ + linux_bash_locale_leak + Memcheck:Leak + fun:malloc + fun:xmalloc + fun:set_default_locale + fun:main +} diff --git a/valgrind-error.sh b/valgrind-error.sh index 7f7441c3e..4cb6be7ca 100755 --- a/valgrind-error.sh +++ b/valgrind-error.sh @@ -3,20 +3,22 @@ # # Our valgrind "error" wrapper. -valgrind --leak-check=full -q "$@" 2> valgrind.tmp +TMP="valgrind.tmp.$$" + +valgrind --suppressions=valgrind-bash.supp --leak-check=full -q "$@" 2> $TMP result="$?" # verify no errors -output="`cat valgrind.tmp`" +output="`cat $TMP`" if [ "$output" != "" ]; then - cat valgrind.tmp >&2 + cat $TMP >&2 result=1 fi -rm valgrind.tmp +rm $TMP exit $result