aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Gustafsson <dgustafsson@postgresql.org>2025-06-17 22:42:38 +0200
committerDaniel Gustafsson <dgustafsson@postgresql.org>2025-06-17 22:42:38 +0200
commit917c00d761fa9ba3b2bc365804ef38fc60ec023e (patch)
tree2f433ee0419c2821858ceaa05a6840b26a012373
parent0cf205e122ae0fe9333ccf843c2269f13ddc32fc (diff)
downloadpostgresql-917c00d761fa9ba3b2bc365804ef38fc60ec023e.tar.gz
postgresql-917c00d761fa9ba3b2bc365804ef38fc60ec023e.zip
Fix allocation check to test the right variable
The memory allocation for cancelConn->be_cancel_key was accidentally checking the be_cancel_key member in the conn object instead of the one in cancelConn. Author: Ranier Vilela <ranier.vf@gmail.com> Reviewed-by: Daniel Gustafsson <daniel@yesql.se> Discussion: https://postgr.es/m/CAEudQAq4ySDR6dsg9xwurBXwud02hX7XCOZZAcZx-JMn6A06nA@mail.gmail.com
-rw-r--r--src/interfaces/libpq/fe-cancel.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/interfaces/libpq/fe-cancel.c b/src/interfaces/libpq/fe-cancel.c
index 8c7c198a530..cd3102346bf 100644
--- a/src/interfaces/libpq/fe-cancel.c
+++ b/src/interfaces/libpq/fe-cancel.c
@@ -114,7 +114,7 @@ PQcancelCreate(PGconn *conn)
if (conn->be_cancel_key != NULL)
{
cancelConn->be_cancel_key = malloc(conn->be_cancel_key_len);
- if (!conn->be_cancel_key)
+ if (cancelConn->be_cancel_key == NULL)
goto oom_error;
memcpy(cancelConn->be_cancel_key, conn->be_cancel_key, conn->be_cancel_key_len);
}