Your logic is..you can do much easier.

You should check that base is not equal to NULL before using it in your while loop

As for your clearMem:

you can do it much simpler: you have a linked list, the last element points to NULL.

To free node after node wiithout losing the list:

create a temp node* that will point to the children[i]->next.,

then children[i] points to temp, here you have both temp and base pointing at the same list(on 2 different levels), except there is children[i] that can be free'd since his children is dealt by temp. And so on so forth untill NULL.

Also, you use an int that can only be equal to 0 or right? if the list is free'd, one for the other cases.

That's how boolean works. You'd better use a boolean, true if you're done, false otherwise, init to false.

here, is it a representation of your trie? IS it how your base works?

https://twitter.com/HarbiFaiza/status/560685581156765696