mirror of
https://github.com/postgres/postgres.git
synced 2026-05-28 04:35:45 -04:00
Fix calculation of how much shared memory is required to store a TOC.
Commit ac883ac453 refactored shm_toc_estimate() but changed its calculation
of shared memory size for TOC incorrectly. Previously this could cause too
large memory to be allocated.
Back-patch to v11 where the bug was introduced.
Author: Takayuki Tsunakawa
Discussion: https://postgr.es/m/TYAPR01MB2990BFB73170E2C4921E2C4DFEA80@TYAPR01MB2990.jpnprd01.prod.outlook.com
This commit is contained in:
parent
ccf4e277a4
commit
2ad78a87f0
1 changed files with 2 additions and 2 deletions
|
|
@ -265,8 +265,8 @@ shm_toc_estimate(shm_toc_estimator *e)
|
|||
Size sz;
|
||||
|
||||
sz = offsetof(shm_toc, toc_entry);
|
||||
sz += add_size(sz, mul_size(e->number_of_keys, sizeof(shm_toc_entry)));
|
||||
sz += add_size(sz, e->space_for_chunks);
|
||||
sz = add_size(sz, mul_size(e->number_of_keys, sizeof(shm_toc_entry)));
|
||||
sz = add_size(sz, e->space_for_chunks);
|
||||
|
||||
return BUFFERALIGN(sz);
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue