valgrind: apply Snow Leopard patch

Closes #27289.