rest
is not destroyed before it can be copied or utilized.
The implementation is as follows:
void List_delete(struct List *pList) { struct _Listnode *pTmp; pTmp = ((struct _List *)pList)->first; free(pList); while (pTmp) { struct _List next; next = pTmp->rest; free(pTmp); pTmp = next.first; } }