title: Remove last node c++ (recursion): double free or corruption (fasttop)
body: <p>I am trying to remove the last node in my single linked list and I keep running up against an error:
  double free or corruption (fasttop): 0x00000000024e9c20</p>
  <pre><code>void removeLast (node *&amp; head) {
      if(head == NULL)
          return;
      if(head-&gt;next == NULL) {
          delete head;
          head = NULL;
          return;
      }
      removeLast(head-&gt;next);
  }
  </code></pre>