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

Fixed bug CORE-4216 : Memory leak with TRIGGER ON TRANSACTION COMMIT

This commit is contained in:
hvlad 2013-09-16 09:17:56 +00:00
parent ecf2413331
commit 8ee66e0bb0

View File

@ -1070,11 +1070,9 @@ void EXE_execute_triggers(thread_db* tdbb,
AutoPtr<Record> null_rec;
if (!old_rec && !new_rec)
{
// this is a database trigger
}
else if (!old_rec || !new_rec)
const bool is_db_trigger = (!old_rec && !new_rec);
if (!is_db_trigger && (!old_rec || !new_rec))
{
const Record* record = old_rec ? old_rec : new_rec;
fb_assert(record && record->rec_format);
@ -1097,6 +1095,8 @@ void EXE_execute_triggers(thread_db* tdbb,
jrd_req* trigger = ptr->statement->findRequest(tdbb);
if (!is_db_trigger)
{
if (trigger->req_rpb.getCount() > 0)
{
trigger->req_rpb[0].rpb_record = old_rec ? old_rec : null_rec.get();
@ -1130,6 +1130,7 @@ void EXE_execute_triggers(thread_db* tdbb,
}
else if (trigger->req_rpb.getCount() > 1)
trigger->req_rpb[1].rpb_number.setValid(false);
}
trigger->req_timestamp = timestamp;
trigger->req_trigger_action = trigger_action;