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:34:43 +0000 (14:34 +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 b0b0e1a6431ced054b86731666a55fa1db6653a3..3fe8c21639e5f025dab79b0930c653cb0322105f 100644 (file)
@@ -2895,6 +2895,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;