8
0
mirror of https://github.com/FirebirdSQL/firebird.git synced 2025-01-23 22:43:04 +01:00

Fixed transactions leak caused by my recent commit

This commit is contained in:
alexpeshkoff 2014-06-10 15:04:01 +00:00
parent 0cace38015
commit dcb2f81695

View File

@ -4311,13 +4311,21 @@ ITransaction* YStatement::execute(IStatus* status, ITransaction* transaction,
ITransaction* newTrans = entry.next()->execute(status, trans, inMetadata, inBuffer,
outMetadata, outBuffer);
if (newTrans)
if (newTrans == trans)
{
if (newTrans == trans)
newTrans = transaction;
else
newTrans = transaction;
}
else
{
if (transaction)
{
if (trans)
trans->addRef(); // Will be decremented by release on next line
transaction->release();
transaction = NULL; // Get ready for correct return in OOM case
}
if (newTrans)
{
newTrans = new YTransaction(attachment, newTrans);
}
}
@ -5201,13 +5209,21 @@ ITransaction* YAttachment::execute(IStatus* status, ITransaction* transaction,
ITransaction* newTrans = entry.next()->execute(status, trans, length, string, dialect,
inMetadata, inBuffer, outMetadata, outBuffer);
if (newTrans)
if (newTrans == trans)
{
if (newTrans == trans)
newTrans = transaction;
else
newTrans = transaction;
}
else
{
if (transaction)
{
if (trans)
trans->addRef(); // Will be decremented by release on next line
transaction->release();
transaction = NULL; // Get ready for correct return in OOM case
}
if (newTrans)
{
newTrans = new YTransaction(this, newTrans);
}
}