Proper way to destroy linked List?
<p>How do I destroy my linked list completely? For instance, right when I create my linked list and call the print list function, nothing happens obviously since nothing is in the list. When I add nodes to the list, it prints them out fine. But when I destroy my list and try to print the list I expect nothing to print out again, but im seg faulting. *The head of my linked list is a dummy node too</p>

<pre><code>void destroyList(listNode *List)
{
    listNode *temp = malloc(sizeof(listNode));
    temp = List-&gt;next;
    while (List != NULL)
    {
        temp = List;
        List = List-&gt;next;
        free(temp);             
    }
}

void printList(listNode * List)
{
    List = List-&gt;next;

    while (List != NULL)
    {
        printf("%d\n",List-&gt;val);        
        List = List-&gt;next;     
    }  
}
</code></pre>