Ticket #8745: file-exists-leak.patch
File file-exists-leak.patch, 1.4 KB (added by , 17 years ago) |
---|
-
common/file.cpp
412 412 } 413 413 414 414 bool File::exists(const String &filename) { 415 FilesystemNode* file;416 String fname = filename;417 418 415 // First try to find the file via a FilesystemNode (in case an absolute 419 416 // path was passed). This is only used to filter out directories. 420 file = new FilesystemNode(fname);421 if (file ->exists())422 return !file ->isDirectory();417 FilesystemNode file(filename); 418 if (file.exists()) 419 return !file.isDirectory(); 423 420 424 421 // See if the file is already mapped 425 if (_filesMap && _filesMap->contains(fname)) { 426 fname = (*_filesMap)[fname]; 427 file = new FilesystemNode(fname); 422 if (_filesMap && _filesMap->contains(filename)) { 423 FilesystemNode file2((*_filesMap)[filename]); 428 424 429 if (file ->exists())430 return !file ->isDirectory();425 if (file2.exists()) 426 return !file2.isDirectory(); 431 427 } 432 428 433 429 // Try all default directories 434 430 if (_defaultDirectories) { 435 431 StringIntMap::const_iterator i(_defaultDirectories->begin()); 436 432 for (; i != _defaultDirectories->end(); ++i) { 437 fname = i->_key+fname; 438 file = new FilesystemNode(fname); 433 FilesystemNode file2(i->_key + filename); 439 434 440 if(file ->exists())441 return !file ->isDirectory();435 if(file2.exists()) 436 return !file2.isDirectory(); 442 437 } 443 438 } 444 439