Use calloc/strdup instead of own impl

Assigning to/from a void pointer is allowed per def in the
spec, so casting it is bogus

Change-Id: I2a8df4509b8d7b609daeeb0275b51f86e611f496
Reviewed-on: http://review.couchbase.org/34930
Tested-by: buildbot <build@couchbase.com>
Reviewed-by: Trond Norbye <trond.norbye@gmail.com>