Fix memory leaks when we have a path option in a config file.

Sadly this requires some nasty looking if checks all over main, but it's
the only way to do it.

stat has memory issues if you don't give it a struct stat, ugh.
Merge pull request #40 from sphia/memory_leaks/path_from_config_file

Fix memory leaks when we have a path option in a config file.