Check return value from asprintf

Otherwise gcc outputs warnings:
ignoring return value of asprintf, declared with attribute
warn_unused_result [-Wunused-result]

Change-Id: Ib43af5d5faf2cff527146b0f315c5146d693ed07
Reviewed-on: http://review.couchbase.org/43044
Tested-by: buildbot <build@couchbase.com>
Reviewed-by: Dave Rigby <daver@couchbase.com>