[BUGFIX] Avoid memory leak during file searches