Do not continue execution after memory error

Change-Id: I546ac12417d3359ed71b53870698a8a9a1013c77
Reviewed-on: http://review.couchbase.org/28926
Tested-by: Sergey Avseyev <sergey.avseyev@gmail.com>
Reviewed-by: Mark Nunberg <mnunberg@haskalah.org>