Allocate a buffer containing a provided string.