diff options
author | Thomas Munro <tmunro@postgresql.org> | 2019-02-25 10:54:12 +1300 |
---|---|---|
committer | Thomas Munro <tmunro@postgresql.org> | 2019-02-25 11:11:40 +1300 |
commit | 29ddb548f683e15429cd5464029c01d83c40bb40 (patch) | |
tree | 1792d2f85f2e47970d978b799df0f3a5f402bea1 /src/backend/access/transam/multixact.c | |
parent | 9e138a401d19acc2129ebfd37e7609589210ff67 (diff) | |
download | postgresql-29ddb548f683e15429cd5464029c01d83c40bb40.tar.gz postgresql-29ddb548f683e15429cd5464029c01d83c40bb40.zip |
Fix inconsistent out-of-memory error reporting in dsa.c.
Commit 16be2fd1 introduced the flag DSA_ALLOC_NO_OOM to control whether
the DSA allocator would raise an error or return InvalidDsaPointer on
failure to allocate. One edge case was not handled correctly: if we
fail to allocate an internal "span" object for a large allocation, we
would always return InvalidDsaPointer regardless of the flag; a caller
not expecting that could then dereference a null pointer.
This is a plausible explanation for a one-off report of a segfault.
Remove a redundant pair of braces so that all three stanzas that handle
DSA_ALLOC_NO_OOM match in style, for visual consistency.
While fixing inconsistencies, if FreePageManagerGet() can't supply the
pages that our book-keeping says it should be able to supply, then we
should always report a FATAL error. Previously we treated that as a
regular allocation failure in one code path, but as a FATAL condition
in another.
Back-patch to 10, where dsa.c landed.
Author: Thomas Munro
Reported-by: Jakub Glapa
Discussion: https://postgr.es/m/CAEepm=2oPqXxyWQ-1o60tpOLrwkw=VpgNXqqF1VN2EyO9zKGQw@mail.gmail.com
Diffstat (limited to 'src/backend/access/transam/multixact.c')
0 files changed, 0 insertions, 0 deletions