Coverity rightfully complains that assigning to `path` will lose its previous value leading to resource leaks.