From: Daniel Gustafsson Date: Mon, 27 May 2024 17:37:17 +0000 (+0200) Subject: Fix check for memory allocation X-Git-Tag: REL_17_BETA2~105 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=4013a5ada25241ead6a3265d6edf9aadb654dc00;p=thirdparty%2Fpostgresql.git Fix check for memory allocation Commit 61461a300c1 accidentally checked memory allocation success using the wrong variable. Author: Ranier Vilela Reviewed-by: Jelte Fennema-Nio Reviewed-by: Daniel Gustafsson Discussion: https://postgr.es/m/CAEudQAqQFTH7xCB-+K6zEKjfqbhqCxcr_w4DuJTxVT6h3vzu2w@mail.gmail.com --- diff --git a/src/interfaces/libpq/fe-cancel.c b/src/interfaces/libpq/fe-cancel.c index 4f00a91b51e..b183eafffad 100644 --- a/src/interfaces/libpq/fe-cancel.c +++ b/src/interfaces/libpq/fe-cancel.c @@ -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;