file: use dynamic memory allocation for tempfile name