title: freeing a linked_list's nodes, by freeing whole object
body: <p>I would to implement the stack using linked-list. Moreover, I want to use something like templates.
  Thus I got such structures:</p>
  
  <ol>
  <li>node</li>
  </ol>
  
  <pre><code>#define node(T)            \
    struct node_##T {        \
      T value;               \
      struct node_##T *next; \
    }
  </code></pre>
  
  <ol start="2">
  <li>stack</li>
  </ol>
  
  <pre><code>#define stack(T)           \
    struct stack_##T {       \
      size_t size;           \
      node(T) * begin, *end; \
    }
  </code></pre>
  
  <p>At the end I want to free the stack. Always I did it using while/recursive. Somthing like that:</p>
  
  <pre><code>while (begin != NULL)
  {
      temp = begin;
      begin = begin-&gt;next;
      free(temp);
  }
  </code></pre>
  
  <p>In my case the usage of this method is more compicated rather than usally. Consequently, I just freeing the object.</p>
  
  <pre><code>#include "stack.h"
  typedef char* string;
  int main() {
    stack(string)* a;
    stack_constructor(string, a);
    stack_resize(a, 5);
    free(a);
    return (0);
  }
  </code></pre>
  
  <p>The debug shows that all is fine. I have set two break-points before "free(a)" and after "free(a)".
  <a href="https://i.stack.imgur.com/LvQXc.png" rel="nofollow noreferrer">before freeing</a>
  <a href="https://i.stack.imgur.com/VyO2k.png" rel="nofollow noreferrer">after freeing</a>
  But I have some doubts about these. I think that we're deleting the memory which we have allocated for the pointer, but the values still in memory. Am I mistakning?</p>