]> git.ipfire.org Git - thirdparty/postgresql.git/commit
Fix leak of LLVM "fatal-on-oom" section counter.
authorHeikki Linnakangas <heikki.linnakangas@iki.fi>
Wed, 5 Jul 2023 10:13:13 +0000 (13:13 +0300)
committerHeikki Linnakangas <heikki.linnakangas@iki.fi>
Wed, 5 Jul 2023 10:13:30 +0000 (13:13 +0300)
commitfa96a74a0f76c49ac5a43a16fca8bf705fa98d99
treebeb39066a8c6b7a8e86d28ea9181e13e5dd07bfa
parent66f8a139731957a7d516ade70cd3aa43d12d3c4f
Fix leak of LLVM "fatal-on-oom" section counter.

llvm_release_context() called llvm_enter_fatal_on_oom(), but was missing
the corresponding llvm_leave_fatal_on_oom() call. As a result, if JIT was
used at all, we were almost always in the "fatal-on-oom" state.

It only makes a difference if you use an extension written in C++, and
run out of memory in a C++ 'new' call. In that case, you would get a
PostgreSQL FATAL error, instead of the default behavior of throwing a
C++ exception.

Back-patch to all supported versions.

Reviewed-by: Daniel Gustafsson
Discussion: https://www.postgresql.org/message-id/54b78cca-bc84-dad8-4a7e-5b56f764fab5@iki.fi
src/backend/jit/llvm/llvmjit.c