Replace xmalloc+snprintf with xasprintf