Fix check for memory allocation
authorDaniel Gustafsson <[email protected]>
Mon, 27 May 2024 17:37:17 +0000 (19:37 +0200)
committerDaniel Gustafsson <[email protected]>
Mon, 27 May 2024 17:37:17 +0000 (19:37 +0200)
Commit 61461a300c1 accidentally checked memory allocation success
using the wrong variable.

Author: Ranier Vilela <[email protected]>
Reviewed-by: Jelte Fennema-Nio <[email protected]>
Reviewed-by: Daniel Gustafsson <[email protected]>
Discussion: https://postgr.es/m/CAEudQAqQFTH7xCB-+K6zEKjfqbhqCxcr_w4DuJTxVT6h3vzu2w@mail.gmail.com

src/interfaces/libpq/fe-cancel.c

index 4f00a91b51edfdb0e3832b751e64022bc48819e2..b183eafffad50a6ea23620145eafd3d462595ee1 100644 (file)
@@ -145,7 +145,7 @@ PQcancelCreate(PGconn *conn)
    }
 
    cancelConn->addr = calloc(cancelConn->naddr, sizeof(AddrInfo));
-   if (!cancelConn->connhost)
+   if (!cancelConn->addr)
        goto oom_error;
 
    cancelConn->addr[0].addr = conn->raddr;