In PQsendQueryStart(), avoid leaking any left-over async result.
authorTom Lane
Mon, 10 Oct 2016 14:35:58 +0000 (10:35 -0400)
committerTom Lane
Mon, 10 Oct 2016 14:35:58 +0000 (10:35 -0400)
Ordinarily there would not be an async result sitting around at this
point, but it appears that in corner cases there can be.  Considering
all the work we're about to launch, it's hardly going to cost anything
noticeable to check.

It's been like this forever, so back-patch to all supported branches.

Report: 

src/interfaces/libpq/fe-exec.c

index 5a7c0254dd35bf53d35d6de2dd3c01314cdedbb0..7ed79a7d7ab70ed755234dfe0878fadec01c9338 100644 (file)
@@ -1384,8 +1384,7 @@ PQsendQueryStart(PGconn *conn)
    }
 
    /* initialize async result-accumulation state */
-   conn->result = NULL;
-   conn->next_result = NULL;
+   pqClearAsyncResult(conn);
 
    /* reset single-row processing mode */
    conn->singleRowMode = false;