Added check for malloc error