Browse Source

Fix valgrind check to ignore bash leak

Sean Parkinson 3 years ago
parent
commit
3444b115ba
3 changed files with 15 additions and 4 deletions
  1. 1 0
      Makefile.am
  2. 8 0
      valgrind-bash.supp
  3. 6 4
      valgrind-error.sh

+ 1 - 0
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

+ 8 - 0
valgrind-bash.supp

@@ -0,0 +1,8 @@
+{
+  linux_bash_locale_leak
+  Memcheck:Leak
+  fun:malloc
+  fun:xmalloc
+  fun:set_default_locale
+  fun:main
+}

+ 6 - 4
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