10000
We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 49137ec commit 4bfc5f1Copy full SHA for 4bfc5f1
src/backend/storage/lmgr/lwlock.c
@@ -350,8 +350,9 @@ CreateLWLocks(void)
350
if (LWLockTrancheArray == NULL)
351
{
352
LWLockTranchesAllocated = 16;
353
- LWLockTrancheArray = MemoryContextAlloc(TopMemoryContext,
354
- LWLockTranchesAllocated * sizeof(LWLockTranche *));
+ LWLockTrancheArray = (LWLockTranche **)
+ MemoryContextAlloc(TopMemoryContext,
355
+ LWLockTranchesAllocated * sizeof(LWLockTranche *));
356
}
357
358
MainLWLockTranche.name = "main";
@@ -423,11 +424,12 @@ LWLockRegisterTranche(int tranche_id, LWLockTranche *tranche)
423
424
425
int i = LWLockTranchesAllocated;
426
- while (i < tranche_id)
427
+ while (i <= tranche_id)
428
i *= 2;
429
- LWLockTrancheArray = repalloc(LWLockTrancheArray,
430
- i * sizeof(LWLockTranche *));
431
+ repalloc(LWLockTrancheArray,
432
+ i * sizeof(LWLockTranche *));
433
LWLockTranchesAllocated = i;
434
435