Simplify list creation
Added check for liine == NULL and leave freeing to the calling program