Skip to content

Fix SQLite binding double free - #472

Merged
lukewilliamboswell merged 1 commit into
mainfrom
fix/issue-471-sqlite-binding-double-free
Aug 14, 2026
Merged

Fix SQLite binding double free#472
lukewilliamboswell merged 1 commit into
mainfrom
fix/issue-471-sqlite-binding-double-free

Conversation

@lukewilliamboswell

@lukewilliamboswell lukewilliamboswell commented Aug 14, 2026

Copy link
Copy Markdown
Collaborator

Closes #471.

Root cause

hosted_sqlite_bind released both the transferred list reference and every refcounted field inside its binding records. Roc retains ownership of those nested fields across hosted calls, so the generated caller later released the heap-backed Str again. Literals and small strings masked the bug because they do not have ordinary heap refcounts.

Fix

  • release only the transferred bindings list reference in hosted_sqlite_bind
  • add a regression using a runtime-allocated 40-byte string that remains live after the SQLite call
  • pin all workflows to nightly-2026-08-13-2fdd90e
  • regenerate the Rust ABI glue with that exact nightly
  • document that CI uses a pinned nightly

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Heap-allocated Str in a Sqlite bindings list is double-freed (deterministic repro under guard-malloc)

1 participant