]> granicus.if.org Git - postgresql/commitdiff
Reset error message at PQreset()
authorHeikki Linnakangas <heikki.linnakangas@iki.fi>
Wed, 29 Oct 2014 12:32:01 +0000 (14:32 +0200)
committerHeikki Linnakangas <heikki.linnakangas@iki.fi>
Wed, 29 Oct 2014 12:39:10 +0000 (14:39 +0200)
If you call PQreset() repeatedly, and the connection cannot be
re-established, the error messages from the failed connection attempts
kept accumulating in the error string.

Fixes bug #11455 reported by Caleb Epstein. Backpatch to all supported
versions.

src/interfaces/libpq/fe-connect.c

index 98d2c60b31ca0dadb3d5bab61ac55be4b755cfc0..8088bdac9833abc1b5d19fcca94af86a9fe09d28 100644 (file)
@@ -2944,6 +2944,7 @@ closePGconn(PGconn *conn)
                                                                                 * absent */
        conn->asyncStatus = PGASYNC_IDLE;
        pqClearAsyncResult(conn);       /* deallocate result */
+       resetPQExpBuffer(&conn->errorMessage);
        pg_freeaddrinfo_all(conn->addrlist_family, conn->addrlist);
        conn->addrlist = NULL;
        conn->addr_cur = NULL;