pg.ddx.io  GitHub: postgresql-interfaces/psqlodbc (issues + PRs as email threads)  
help / color / mirror / Atom feed
[postgresql-interfaces/psqlodbc] PR #190: Fix double-free / heap corruption during SQLDisconnect cleanup (#189)
3+ messages / 1 participants
[nested] [flat]

* [postgresql-interfaces/psqlodbc] PR #190: Fix double-free / heap corruption during SQLDisconnect cleanup (#189)
@ 2026-05-22 14:06  "davecramer (@davecramer)" <noreply+davecramer@github.com>
  0 siblings, 0 replies; 3+ messages in thread

From: davecramer (@davecramer) @ 2026-05-22 14:06 UTC (permalink / raw)
  To: postgresql-interfaces/psqlodbc <noreply+postgresql-interfaces-psqlodbc@github.com>

CC_cleanup() was freeing statement and descriptor objects via SC_Destructor(), but the ODBC Driver Manager still held handles to them. When the DM later called SQLFreeStmt(SQL_DROP) via SQLFreeHandle(), the driver dereferenced freed memory, causing the double-free detected by Application Verifier with Page Heap enabled.

Fix by detaching statements/descriptors in CC_cleanup() without freeing them. The DM will free them later through the normal SQLFreeHandle path. Also allow SQLFreeStmt(SQL_DROP) to proceed when hdbc is NULL (the expected state after disconnect), and remove misleading error-return logic in SC_Destructor that reported failure after already freeing.

^ permalink  raw  [nested|flat] 3+ messages in thread

* Re: [postgresql-interfaces/psqlodbc] PR #190: Fix double-free / heap corruption during SQLDisconnect cleanup (#189)
@ 2026-05-30 16:01  "davecramer (@davecramer)" <noreply+davecramer@github.com>
  1 sibling, 0 replies; 3+ messages in thread

From: davecramer (@davecramer) @ 2026-05-30 16:01 UTC (permalink / raw)
  To: postgresql-interfaces/psqlodbc <noreply+postgresql-interfaces-psqlodbc@github.com>

@davecramer merged this (commit 56f3422a9863).

^ permalink  raw  [nested|flat] 3+ messages in thread

* Re: [postgresql-interfaces/psqlodbc] PR #190: Fix double-free / heap corruption during SQLDisconnect cleanup (#189)
@ 2026-05-30 16:01  "davecramer (@davecramer)" <noreply+davecramer@github.com>
  1 sibling, 0 replies; 3+ messages in thread

From: davecramer (@davecramer) @ 2026-05-30 16:01 UTC (permalink / raw)
  To: postgresql-interfaces/psqlodbc <noreply+postgresql-interfaces-psqlodbc@github.com>

@davecramer closed this.

^ permalink  raw  [nested|flat] 3+ messages in thread


end of thread, other threads:[~2026-05-30 16:01 UTC | newest]

Thread overview: 3+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2026-05-22 14:06 [postgresql-interfaces/psqlodbc] PR #190: Fix double-free / heap corruption during SQLDisconnect cleanup (#189) "davecramer (@davecramer)" <noreply+davecramer@github.com>
2026-05-30 16:01 ` "davecramer (@davecramer)" <noreply+davecramer@github.com>
2026-05-30 16:01 ` "davecramer (@davecramer)" <noreply+davecramer@github.com>

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox