Fix various memory leak/not initialized errors

These were found with valgrind and fix the failover log unit test
which was sporadically failing. I plan on doing a second pass of
this stuff, but want to get this in quickly since if fixes an issue.

Change-Id: Ic13e6439700d61c87e8500da8eca7b2e8260f0e5
Reviewed-on: http://review.couchbase.org/34354
Reviewed-by: abhinav dangeti <abhinav@couchbase.com>
Tested-by: abhinav dangeti <abhinav@couchbase.com>