aboutsummaryrefslogtreecommitdiff
path: root/src/backend/jit/llvm/llvmjit_error.cpp
diff options
context:
space:
mode:
authorMichael Paquier <michael@paquier.xyz>2021-09-13 13:24:27 +0900
committerMichael Paquier <michael@paquier.xyz>2021-09-13 13:24:27 +0900
commitb34dcf87f685ab6c7705d4dd504f23025bfc75b0 (patch)
tree8d4b3ab9ba4e034cec6a4faab6d226302cb864fb /src/backend/jit/llvm/llvmjit_error.cpp
parent3adde7eb6633bea734c4513ebd96adca78b7737c (diff)
downloadpostgresql-b34dcf87f685ab6c7705d4dd504f23025bfc75b0.tar.gz
postgresql-b34dcf87f685ab6c7705d4dd504f23025bfc75b0.zip
Fix error handling with threads on OOM in ECPG connection logic
An out-of-memory failure happening when allocating the structures to store the connection parameter keywords and values would mess up with the set of connections saved, as on failure the pthread mutex would still be hold with the new connection object listed but free()'d. Rather than just unlocking the mutex, which would leave the static list of connections into an inconsistent state, move the allocation for the structures of the connection parameters before beginning the test manipulation. This ensures that the list of connections and the connection mutex remain consistent all the time in this code path. This error is unlikely going to happen, but this could mess up badly with ECPG clients in surprising ways, so backpatch all the way down. Reported-by: ryancaicse Discussion: https://postgr.es/m/17186-b4cfd8f0eb4d1dee@postgresql.org Backpatch-through: 9.6
Diffstat (limited to 'src/backend/jit/llvm/llvmjit_error.cpp')
0 files changed, 0 insertions, 0 deletions