Make use of xasprintf instead of asprintf
---
Closes #1278