Replace few string allocs and copy with strdup

Change-Id: I33cba00877556171693989e07af23ace7c0eba90
Reviewed-on: http://review.couchbase.org/32406
Reviewed-by: Filipe David Borba Manana <fdmanana@gmail.com>
Tested-by: Filipe David Borba Manana <fdmanana@gmail.com>