strtok uses a static pointer to keep track of where it is, that's why it's not thread safe. I took a look at the source code (strtok is only a handful of lines long, /glibc-2.7/string/strtok.c in the tarball) and it seems to only manipulate pointers pointing to your original string, so there's no need to free anything it returns. Just free the buffer the string was in at the end if it was dynamically allocated.