title: How does memory leakage occur in C?
body: <p>I'm having a bit of difficulty trying to visualize how leakage occurs. We're given this code and it can be compiled and run but it leaks memory. &quot;How does the program leak memory? Draw and explain.&quot;</p>
  <pre><code>#include &lt;stdlib.h&gt;
  
  struct nod {
      char name[30];
      int tel;
      struct nod * next;
      struct nod * prev;
  };
  typedef struct nod Nod;
  
  int main() {
      Nod * p =  malloc(sizeof(Nod));
      p -&gt; next =  malloc(sizeof(Nod));
      p -&gt; next -&gt; prev = p;
      free(p);
  }
  </code></pre>