Skip to content

Commit

Permalink
Fixed CORE-5285: Segfault when attachment is closed before it's reque…
Browse files Browse the repository at this point in the history
…st/statement/etc.
  • Loading branch information
AlexPeshkoff committed Jun 20, 2016
1 parent 3bece52 commit 5cf6d59
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions src/yvalve/why.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3873,6 +3873,7 @@ FB_API_HANDLE& YEvents::getHandle()
void YEvents::destroy(unsigned dstrFlags)
{
attachment->childEvents.remove(this);
attachment = NULL;
removeHandle(&events, handle);

if (!(dstrFlags & DF_RELEASE))
Expand Down Expand Up @@ -4069,7 +4070,9 @@ FB_API_HANDLE& YBlob::getHandle()
void YBlob::destroy(unsigned dstrFlags)
{
attachment->childBlobs.remove(this);
attachment = NULL;
transaction->childBlobs.remove(this);
transaction = NULL;

removeHandle(&blobs, handle);

Expand Down Expand Up @@ -4191,6 +4194,7 @@ void YStatement::destroy(unsigned dstrFlags)
}

attachment->childStatements.remove(this);
attachment = NULL;

removeHandle(&statements, handle);

Expand Down Expand Up @@ -4477,6 +4481,7 @@ void YResultSet::destroy(unsigned dstrFlags)

fb_assert(transaction);
transaction->childCursors.remove(this);
transaction = NULL;

destroy2(dstrFlags);
}
Expand Down Expand Up @@ -4707,7 +4712,10 @@ void YTransaction::destroy(unsigned dstrFlags)
childCursors.destroy(dstrFlags & ~DF_RELEASE);

if (attachment)
{
attachment->childTransactions.remove(this);
attachment = NULL;
}

removeHandle(&transactions, handle);

Expand Down Expand Up @@ -4911,7 +4919,10 @@ YTransaction* YTransaction::enterDtc(CheckStatusWrapper* status)
next->addRef(); // We use NoIncr in YTransaction ctor

if (attachment)
{
attachment->childTransactions.remove(this);
attachment = NULL;
}

removeHandle(&transactions, handle);
next = NULL;
Expand Down

0 comments on commit 5cf6d59

Please sign in to comment.