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

Potential memory leak with sqlite3_expanded_sql? #22

Open
burdiyan opened this issue Dec 21, 2021 · 0 comments
Open

Potential memory leak with sqlite3_expanded_sql? #22

burdiyan opened this issue Dec 21, 2021 · 0 comments

Comments

@burdiyan
Copy link

burdiyan commented Dec 21, 2021

According to the docs strings returned by sqlite3_expanded_sql should be freed manually with sqlite3_free:

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

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().

Here the C value is passed directly to C.GoString. I'm not an expert in CGO and I don't know if this could be a potential memory leak.

return C.GoString(C.sqlite3_expanded_sql(stmt.stmt))

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

No branches or pull requests

1 participant