Ho modificato la funzione seguendo i tuoi consigli:
codice:
list build_list(list *l, char c[])   //funzione 4
{
    list p, q, n;
    list head = NULL, tail = NULL;
    
    if(*l != NULL)
    {
        q = (*l);
        while(q->next != NULL)
        {
            if(strcmp(q->next->info.cognome, c) == 0)
            {
                n = newnode();
                n->info = q->next->info;
                n->next = NULL;
                
                if(head == NULL)
                {
                    head = n;
                    tail = n;
                }
                else
                {
                    tail->next = n;
                    tail = n;
                }
                
                p = q->next;
                q->next = q->next->next;
                free(p);
            }
            else 
                q = q->next;
        }
        
        if(strcmp((*l)->info.cognome, c) == 0) //gestisco la testa della lista
        {
            n = newnode();
            n->info = (*l)->info;
            n->next = NULL;
                
            if(head == NULL)
            {
                head = n;
                tail = n;
            }
            else
            {
                tail->next = n;
                tail = n;
            }
            
            p = (*l);
            (*l) = (*l)->next;
            free(p);
        }
    }
    return head;
}
E ora funziona. Grazie mille