2006-11-20 Tatsuhiro Tsujikawa <tujikawa at rednoah dot com>

* src/DefaultBtProgressInfoFile.cc
	(load): Fixed memory leak when the infohash doesn't match.
pull/1/head
Tatsuhiro Tsujikawa 2006-11-28 11:33:43 +00:00
parent c2686b1c50
commit ff3ab41b18
2 changed files with 12 additions and 3 deletions

View File

@ -1,3 +1,8 @@
2006-11-20 Tatsuhiro Tsujikawa <tujikawa at rednoah dot com>
* src/DefaultBtProgressInfoFile.cc
(load): Fixed memory leak when the infohash doesn't match.
2006-11-11 Tatsuhiro Tsujikawa <tujikawa at rednoah dot com>
* src/DefaultPeerStorage.cc

View File

@ -104,7 +104,7 @@ void DefaultBtProgressInfoFile::load() {
}
if(Util::toHex(savedInfoHash, btContext->getInfoHashLength()) !=
btContext->getInfoHashAsString()) {
throw new DlAbortEx("Incorrect infoHash.");
throw string("infoHashMismatch");
}
if(fread(savedBitfield, pieceStorage->getBitfieldLength(), 1, file) < 1) {
throw string("readError");
@ -136,8 +136,12 @@ void DefaultBtProgressInfoFile::load() {
delete [] savedInfoHash;
}
fclose(file);
throw new DlAbortEx(EX_SEGMENT_FILE_READ,
filename.c_str(), strerror(errno));
if(ex == "infoHashMismatch") {
throw new DlAbortEx("The infoHash in torrent file doesn't match to one in .aria2 file.");
} else {
throw new DlAbortEx(EX_SEGMENT_FILE_READ,
filename.c_str(), strerror(errno));
}
}
logger->info(MSG_LOADED_SEGMENT_FILE);
}