tests/crlf: enable calling asn1Decoding using VALGRIND

Signed-off-by: Dmitry Baryshkov <dbaryshkov@gmail.com>
diff --git a/tests/crlf.sh b/tests/crlf.sh
index 54a3199..de9bece 100755
--- a/tests/crlf.sh
+++ b/tests/crlf.sh
@@ -22,6 +22,14 @@
 set -e
 
 srcdir=${srcdir:-.}
+
+ASAN_OPTIONS="detect_leaks=0:exitcode=6"
+export ASAN_OPTIONS
+
+if ! test -z "${VALGRIND}";then
+VALGRIND="${LIBTOOL:-libtool} --mode=execute ${VALGRIND} --error-exitcode=7"
+fi
+
 ASN1DECODING=../src/asn1Decoding${EXEEXT}
 
 # The crlf.cer file is a normal certificate which contains bytes 0x0A
@@ -29,7 +37,7 @@
 # when using fopen/fgetc/fscanf on streams on some systems (read:
 # Windows).
 
-$ASN1DECODING \
+$VALGRIND $ASN1DECODING \
     $srcdir/../examples/pkix.asn \
     $srcdir/crlf.cer \
     PKIX1Implicit88.Certificate >/dev/null 2>&1