Skip to content

Commit b05b603

Browse files
committed
Fixed bug #7942 : Error: database file appears corrupted after restore from backup (FB5, RC2)
Don't use common SortOwner for sorts with different dbb's. After #7671 it could contain cached sort buffers from different pools (dbb_permanent) and then release it to the wrong dbb_sort_buffers making possible usage of deallocated memory later.
1 parent 48915d1 commit b05b603

File tree

1 file changed

+2
-5
lines changed

1 file changed

+2
-5
lines changed

src/jrd/idx.cpp

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -218,7 +218,6 @@ class IndexCreateTask : public Task
218218
m_tdbb_flags(tdbb->tdbb_flags),
219219
m_flags(0),
220220
m_creation(creation),
221-
m_sorts(*m_pool, m_dbb),
222221
m_items(*m_pool),
223222
m_stop(false),
224223
m_countPP(0),
@@ -291,7 +290,6 @@ class IndexCreateTask : public Task
291290
{
292291
if (m_sort)
293292
{
294-
MutexLockGuard guard(getTask()->m_mutex, FB_FUNCTION);
295293
delete m_sort;
296294
m_sort = NULL;
297295
}
@@ -384,8 +382,8 @@ class IndexCreateTask : public Task
384382

385383
MutexLockGuard guard(getTask()->m_mutex, FB_FUNCTION);
386384

387-
m_sort = FB_NEW_POOL(getTask()->m_sorts.getPool())
388-
Sort(att->att_database, &getTask()->m_sorts,
385+
m_sort = FB_NEW_POOL(m_tra->tra_sorts.getPool())
386+
Sort(att->att_database, &m_tra->tra_sorts,
389387
creation->key_length + sizeof(index_sort_record),
390388
2, 1, creation->key_desc, callback, callback_arg);
391389

@@ -428,7 +426,6 @@ class IndexCreateTask : public Task
428426
const ULONG m_tdbb_flags;
429427
ULONG m_flags;
430428
IndexCreation* m_creation;
431-
SortOwner m_sorts;
432429
bid m_exprBlob;
433430
bid m_condBlob;
434431

0 commit comments

Comments
 (0)