Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
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:41:32 +0000 (14:41 +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 540426cbe96c2f40617dacd97a89737c329fef75..2dd244972a9d654700ad72f6d8ffb8f8d4f3ff6d 100644 (file)
@@ -2894,6 +2894,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;