Update linkedlist.c

added some sanity checking and removed redundant statements