Skip to content

Commit 917c00d

Browse files
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
1 parent 0cf205e commit 917c00d

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/interfaces/libpq/fe-cancel.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,7 @@ PQcancelCreate(PGconn *conn)
114114
if (conn->be_cancel_key != NULL)
115115
{
116116
cancelConn->be_cancel_key = malloc(conn->be_cancel_key_len);
117-
if (!conn->be_cancel_key)
117+
if (cancelConn->be_cancel_key == NULL)
118118
goto oom_error;
119119
memcpy(cancelConn->be_cancel_key, conn->be_cancel_key, conn->be_cancel_key_len);
120120
}

0 commit comments

Comments
 (0)