riporto il codice che ho utilizzato per deallocare la lista LS e la matrice dinamica membro della struttura di tipo Word membro della lista.
sempre che il problema sia qui...codice:#include <stdio.h> #include <stdlib.h> typedef struct _word { char word[SIZE_WRD]; char **tabS; unsigned int len_wrd; unsigned int num_syll; unsigned int occurrences; } Word; /*Puntatore a strutura*/ typedef struct _LS{ Word found; struct _LS *nextPt; } LS; typedef LS *LS_PT; /*elimino tutti i nodi della lista*/ void delList (LS_PT root){ LS_PT temp = NULL; while (root){ temp = root; freeMatr (temp->found.tabS, temp->found.num_syll); free(temp); root = root->nextPt; } return; } /*disalloco matrice*/ void freeMatr (char **matrix, int len){ int i; for (i = 0; i < len; i++) free(matrix[i]); free(matrix); return; }

Rispondi quotando