fix bug: double free or segment fault

fix bug: double free or segment fault
when it is deleted, we can not use it->next any more.