Skip to content

Commit

Permalink
Fixed CORE-2173: Server crash after ubnormal disconnect with open Exe…
Browse files Browse the repository at this point in the history
…cuteStatement
  • Loading branch information
AlexPeshkoff committed Nov 10, 2008
1 parent 30af813 commit 4f48013
Showing 1 changed file with 14 additions and 6 deletions.
20 changes: 14 additions & 6 deletions src/jrd/execute_statement.cpp
Expand Up @@ -89,7 +89,8 @@ void startCallback(thread_db* tdbb)
#if (defined DEV_BUILD && !defined MULTI_THREAD)
tdbb->getDatabase()->dbb_flags |= DBB_exec_statement;
#endif
tdbb->getTransaction()->tra_callback_count++;
if (tdbb->getTransaction())
tdbb->getTransaction()->tra_callback_count++;
THREAD_EXIT();
}

Expand All @@ -99,7 +100,8 @@ void finishCallback(thread_db* tdbb)
#if (defined DEV_BUILD && !defined MULTI_THREAD)
tdbb->getDatabase()->dbb_flags &= ~DBB_exec_statement;
#endif
tdbb->getTransaction()->tra_callback_count--;
if (tdbb->getTransaction())
tdbb->getTransaction()->tra_callback_count--;
}

} // anonymous namespace
Expand Down Expand Up @@ -294,15 +296,21 @@ void ExecuteStatement::Close(thread_db* tdbb)

Statement = 0;
}
char* p = reinterpret_cast<char*>(Sqlda);
delete[] p;

// if transaction is already missing, it's pool is also deleted,
// i.e. impossible and no use deleting something from it
if (tdbb->getTransaction()) {
char* p = reinterpret_cast<char*>(Sqlda);
delete[] p;
delete[] Buffer;
}
Sqlda = 0;
Buffer = 0;

if (Transaction) {
delete YValve::translate<YValve::Transaction>(&Transaction);
Transaction = 0;
}
delete[] Buffer;
Buffer = 0;
}

XSQLDA* ExecuteStatement::MakeSqlda(thread_db* tdbb, short n)
Expand Down

0 comments on commit 4f48013

Please sign in to comment.