Fix tree_getpath to work with paths longer then 256 bytes.

We use a temporary POOLMEM buffer for the storage of the full
PATH but as we were passing that as a pointer not a pointer to
a pointer when the buffer reaches 256 bytes the check_pool_memory_size
will allocate a new buffer but as we cannot pass the right new buffer
back to the calling function we were still using the already freed
buffer which we pass back to the calling function which then tries
to free that pointer again which leads to the memory allocator blowing
up with a double free error.