input.c/libcpp: fix lifetimes of path buffers