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.
Merge pull request #2 from zmldndx/patch-1

fix bug: double free or segment fault