diff --git a/lib/nodes/file.c b/lib/nodes/file.c index c54ba20a1..14cee06bd 100644 --- a/lib/nodes/file.c +++ b/lib/nodes/file.c @@ -214,7 +214,8 @@ int file_start(struct node *n) /* Check if directory exists */ struct stat sb; - char *dir = dirname(f->uri); + char *cpy = strdup(f->uri); + char *dir = dirname(cpy); ret = stat(dir, &sb); if (ret) { @@ -232,6 +233,8 @@ int file_start(struct node *n) serror("Failed to create directory"); } + free(cpy); + /* Open file */ flags = SAMPLE_HAS_ALL; if (f->flush)