Message-ID: From: "harukat (@harukat)" To: "postgresql-interfaces/psqlodbc" Date: Thu, 24 Apr 2025 04:52:57 +0000 Subject: [postgresql-interfaces/psqlodbc] PR #113: SQLFreeStmt(stmt,SQL_DROP) now returns an error when it's conn has been disconnected. List-Id: X-GitHub-Author-Id: 3201952 X-GitHub-Author-Login: harukat X-GitHub-Issue: 113 X-GitHub-Repo: postgresql-interfaces/psqlodbc X-GitHub-State: merged X-GitHub-Type: pull_request X-GitHub-Url: https://github.com/postgresql-interfaces/psqlodbc/pull/113 Content-Type: text/plain; charset=utf-8 SQLFreeStmt(stmt, SQL_DROP) now returns an error before trying to free statement resources when its connection already has been closed. A crash occurred when the PostgreSQL server terminated and a connection was subsequently attempted from an application when connection pooling by the driver manager was enabled and several pooled connections existed. In such cases, an invalid memory access would occur in ENTER_CONN_CS(conn) in SQLFreeStmt(), or an invalid address free() would be attempted in SC_clear_error() via PGAPI_FreeStmt(). "CC_cleanup()" doing "conn->status = CONN_NOT_CONNECTED" releases all statements belonging to the connection, so this change will probably not cause a resource leak.