title: Should I free a temp pointer used to traverse a linked list?
body: <p>If I have something like:</p>
  
  <pre><code>function(DLL *dll) {
      DLL_Node *temp = dll-&gt;head
  
      // do stuff with temp like traverse list with temp=temp-&gt;next
  
      // say when done, temp = dll-&gt;tail, should I free(temp) or leave it alone?
  }
  </code></pre>
  
  <p>I'm still not very experienced with pointers, it seems like I created an extra pointer, but it just points to a position in the list, so I shouldn't free it and it will get cleared when function ends? </p>
  
  <p>By the way I defined <code>DLL</code> and <code>DLL_Node</code> like this:</p>
  
  <pre><code>typedef struct dll_node {
      int data;
      struct dll_node *prev;
      struct dll_node *next;
  } DLL_Node;
  
  typedef struct DLL_ {
      int count;
      DLL_Node *head;
      DLL_Node *tail;
  } DLL;
  </code></pre>
  
  <p>I saw a recommendation for the program valgrind for testing for memory leaks and it says definitely lost and indirectly lost are both 0 bytes, but possibly lost is 2,064 bytes. Not sure what that means exactly or if it's relevant. </p>