Fix copy-paste mistake in PQcancelCreate
authorAlvaro Herrera <alvherre@alvh.no-ip.org>
Mon, 1 Jul 2024 11:58:22 +0000 (13:58 +0200)
committerAlvaro Herrera <alvherre@alvh.no-ip.org>
Mon, 1 Jul 2024 11:58:22 +0000 (13:58 +0200)
When an OOM occurred, this function was incorrectly setting a status of
CONNECTION_BAD on the passed in PGconn instead of on the newly created
PGcancelConn.

Mistake introduced with 61461a300c1c.  Backpatch to 17.

Author: Jelte Fennema-Nio <postgres@jeltef.nl>
Reported-by: Noah Misch <noah@leadboat.com>
Discussion: https://postgr.es/m/20240630190040.26.nmisch@google.com

src/interfaces/libpq/fe-cancel.c

index 3b6206ea7ffc014a5e2547031725d356c65840a7..9562a7fe44338d9c9175fe87b6efb178624dce93 100644 (file)
@@ -155,7 +155,7 @@ PQcancelCreate(PGconn *conn)
    return (PGcancelConn *) cancelConn;
 
 oom_error:
-   conn->status = CONNECTION_BAD;
+   cancelConn->status = CONNECTION_BAD;
    libpq_append_conn_error(cancelConn, "out of memory");
    return (PGcancelConn *) cancelConn;
 }