MB-8176: Fix all valgrind warnings in unit tests

Change-Id: Idd23b2dc8cdb79602c01309a47e0ea3c387fd7ab
Reviewed-on: http://review.couchbase.org/25978
Tested-by: Michael Wiederhold <mike@couchbase.com>
Reviewed-by: Michael Wiederhold <mike@couchbase.com>