v3-0003-Fix-copy-paste-mistake-in-PQcancelCreate.patch

application/octet-stream

Filename: v3-0003-Fix-copy-paste-mistake-in-PQcancelCreate.patch
Type: application/octet-stream
Part: 1
Message: Re: [EXTERNAL] Re: Add non-blocking version of PQcancel

Patch

Format: format-patch
Series: patch v3-0003
Subject: Fix copy-paste mistake in PQcancelCreate
File+
src/interfaces/libpq/fe-cancel.c 1 1
From 5f72aa57fa0623c295b26e065e49e0f4945185ec Mon Sep 17 00:00:00 2001
From: Jelte Fennema-Nio <github-tech@jeltef.nl>
Date: Mon, 1 Jul 2024 00:33:41 +0200
Subject: [PATCH v3 3/3] Fix copy-paste mistake in PQcancelCreate

When an OOM occeured it was incorrectly setting a status of
CONNECTION_BAD on the passed in PGconn istead of on the newly
created PGcancelConn.
---
 src/interfaces/libpq/fe-cancel.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/interfaces/libpq/fe-cancel.c b/src/interfaces/libpq/fe-cancel.c
index 3b6206ea7f..9562a7fe44 100644
--- a/src/interfaces/libpq/fe-cancel.c
+++ b/src/interfaces/libpq/fe-cancel.c
@@ -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;
 }
-- 
2.34.1