summaryrefslogtreecommitdiff
path: root/src/AbstractCommand.cc
diff options
context:
space:
mode:
authorTatsuhiro Tsujikawa <tatsuhiro.t@gmail.com>2010-01-11 15:35:12 +0000
committerTatsuhiro Tsujikawa <tatsuhiro.t@gmail.com>2010-01-11 15:35:12 +0000
commitf3b1defc97a1ce72a08631809feb869a9a3448c1 (patch)
tree1c58a880e3648d41a0e334d41218430cd46b1600 /src/AbstractCommand.cc
parent768f78f7713716816a21f03edcd8020ab708b4b1 (diff)
2010-01-12 Tatsuhiro Tsujikawa <t-tujikawa@users.sourceforge.net>
Fixed memory leak. Commands stored in std::deque<Command*> are not deleted when exception is thrown. Make sure that when passing std::deque<Command*> to function to store Commands, handle exception and delete these Commands. * src/AbstractCommand.cc * src/CheckIntegrityCommand.cc * src/FileAllocationCommand.cc * src/RequestGroup.cc * src/TrackerWatcherCommand.cc
Diffstat (limited to 'src/AbstractCommand.cc')
-rw-r--r--src/AbstractCommand.cc8
1 files changed, 6 insertions, 2 deletions
diff --git a/src/AbstractCommand.cc b/src/AbstractCommand.cc
index 52fd872a..e86103e5 100644
--- a/src/AbstractCommand.cc
+++ b/src/AbstractCommand.cc
@@ -530,8 +530,12 @@ void AbstractCommand::prepareForNextAction(Command* nextCommand)
(new StreamCheckIntegrityEntry(_requestGroup, nextCommand));
std::deque<Command*> commands;
- _requestGroup->processCheckIntegrityEntry(commands, entry, e);
-
+ try {
+ _requestGroup->processCheckIntegrityEntry(commands, entry, e);
+ } catch(RecoverableException& e) {
+ std::for_each(commands.begin(), commands.end(), Deleter());
+ throw;
+ }
e->addCommand(commands);
e->setNoWait(true);
}