Fix check for memory allocation

Commit 61461a300c accidentally checked memory allocation success
using the wrong variable.

Author: Ranier Vilela <ranier.vf@gmail.com>
Reviewed-by: Jelte Fennema-Nio <postgres@jeltef.nl>
Reviewed-by: Daniel Gustafsson <daniel@yesql.se>
Discussion: https://postgr.es/m/CAEudQAqQFTH7xCB-+K6zEKjfqbhqCxcr_w4DuJTxVT6h3vzu2w@mail.gmail.com
This commit is contained in:
Daniel Gustafsson 2024-05-27 19:37:17 +02:00
parent 7c655a04a2
commit 4013a5ada2

View File

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