When you reach the end of the list, you return the last node. That last node's next value then gets assigned to itself, hence you'd create an inconsistency. If current is NULL, return NULL instead and simply disregard the rest of the code if the return is NULL.