forgot to free malloced memory in loop examples