MB-100 Fix clang static analyzer memory warnings

Change-Id: Iffdcd6c0f1e0a6ea96a80807b05d87bdbe755ff2
Reviewed-on: http://review.couchbase.org/26797
Reviewed-by: Fulu Li <fulu@couchbase.com>
Tested-by: Aaron Miller <apage43@ninjawhale.com>