use of asprintf instead of strlen + malloc + sprintf