use a temporary buffer for debug output

Passing va_list's doesn't work, duh.
destroy the linked-list of filenames when we build the index.

We don't free the ->name entry of each node, because it will
now be pointed at by the index instead.