Adjusted doubly linked list operation function
  Fixed a bug of memory leak