title: How to Free Memory of A Structure with Pointers to another Structure
body: <p>I have two structures</p>
  
  <pre><code>struct SimpleXY
  {
      double x;
      double y;
  
  };
  
      struct SimpleXyLink
      {
              int num_xy;
              SimpleXY *simpleXyList;
      };
  </code></pre>
  
  <p>I wonder what is the proper way to free the memory hold by <code>SimplyXyLink</code>? I am currently using </p>
  
  <pre><code>void Free(SimpleXyLink *myList)
  {
  
      free(myList-&gt;simpleXyList);
  }
  </code></pre>
  
  <p>But I think this is wrong because it doesn't free the memory inside the element of <code>simpleXyList</code>. </p>