Memory Efficient doubly linked list in C