fixed static checker warnings

fixed static checker warning

unused variable _ls_oldhead and _tmp plus a potential null pointer
dereference with _ls_tail. 78 tests conducted, 0 failed.

_tmp was unused but _tmp2 was used, so I've removed _tmp and then renamed _tmp2 into  _tmp.