Valgrind: Reduce number of function calls

Change-Id: Ie243f55ee7b632d164ed70062fbfd129de3753b9
Reviewed-by: Christian Kandeler <christian.kandeler@digia.com>