Free memory allocated

This commit is contained in:
NRZ Code 2025-05-01 10:11:35 -03:00
parent ea8f9f47e6
commit fc0b626edf

4
wc.c
View file

@ -104,6 +104,10 @@ void wc(char **list, int count) {
printf("%*d ", intlen(items[TOTAL][MLLEN]), items[TOTAL][MLLEN]); printf("%*d ", intlen(items[TOTAL][MLLEN]), items[TOTAL][MLLEN]);
printf("total\n"); printf("total\n");
} }
for (int i = 0; i < count; i++) {
free(items[i]);
}
free(items);
} }
int main(int argc, char **argv) { int main(int argc, char **argv) {