Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: expanded sql leak #500

Merged
merged 2 commits into from
Feb 3, 2024
Merged

Conversation

flavorjones
Copy link
Member

cc @tenderlove

This actually was caught by the test suite in https://github.com/sparklemotion/sqlite3-ruby/actions/runs/7745352446/job/21121203412#step:6:82 but I missed it because we've been having some flaky failures of the valgrind/memcheck suite (see #489).

@tenderlove
Copy link
Member

Oh wow, thank you. I didn't realize you had to free the string, but I guess it makes sense. 🤦🏻‍♀️

from https://www.sqlite.org/c3ref/expanded_sql.html

> The strings returned by sqlite3_sql(P) and sqlite3_normalized_sql(P)
> are managed by SQLite and are automatically freed when the prepared
> statement is finalized. The string returned by
> sqlite3_expanded_sql(P), on the other hand, is obtained from
> sqlite3_malloc() and must be freed by the application by passing it
> to sqlite3_free().
@flavorjones flavorjones force-pushed the flavorjones-fix-expanded-sql-leak branch from 88235da to 979e8b2 Compare February 2, 2024 22:49
@flavorjones flavorjones merged commit 1cdaa42 into main Feb 3, 2024
102 checks passed
@flavorjones flavorjones deleted the flavorjones-fix-expanded-sql-leak branch February 3, 2024 00:05
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.

None yet

2 participants