Check for return value for asprintf

Change-Id: Ib163468aac1a5e52cef28c59b55be2287dc4ba43
Reviewed-on: http://review.couchbase.org/43023
Reviewed-by: Trond Norbye <trond.norbye@gmail.com>
Tested-by: Trond Norbye <trond.norbye@gmail.com>