diff --git a/tests/runtests.pl b/tests/runtests.pl
index 8de3c0690f19715e6e6abb9af76c495a0c79c6ab..2d9a97ed99ceb49bd6dc707f3218b9fc8df6e22f 100755
--- a/tests/runtests.pl
+++ b/tests/runtests.pl
@@ -1024,7 +1024,7 @@ sub singletest {
     }
 
     if($valgrind) {
-        $CMDLINE = "exec 3>log/valgrind$testnum && $CMDLINE";
+        $CMDLINE = "valgrind --leak-check=yes --logfile=log/valgrind$testnum -q $CMDLINE";
     }
 
     $CMDLINE .= "$cmdargs >>$STDOUT 2>>$STDERR";
@@ -1476,9 +1476,6 @@ if($valgrind) {
         #print "Valgrind failure, disable it\n";
         undef $valgrind;
     }
-    else {
-        $CURL="valgrind --leak-check=yes --logfile-fd=3 -q $CURL";
-    }
 }
 
 #######################################################################