-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
[FFI] Work with a pointer to a string #44017
Comments
If you'd remove if (password == NULL)
password = ""; then you could just check in dart if the pointer equals Note that is perfectly possible to free |
I completely missed that this is the Postgres API (thanks @mraleph for pointing that out)! When using an existing library, the existing library has a policy about its resource management. The postgres documentation on the function does not mention resource management at all: https://www.postgresql.org/docs/12/libpq-status.html. However, given that the implementation directly returns |
@dcharkes thanks a lot |
I am facing a problem when working with strings. For example:
https://github.com/postgres/postgres/blob/8a15e735be00f156a7227741c0ce88702e6de099/src/interfaces/libpq/fe-connect.c#L6535
when I use dart-lang/native#508
I get an error
I guess the error occurs when the function returns an empty string(
password = "";
) and I try to free memory.(for strings withoutmalloc
)How can I understand when I need to free up memory, and when not?(
password = conn->pgpass;
withmalloc
)Originally posted by @listepo in #34452 (comment)
@dcharkes can you help me? thanks in advance
The text was updated successfully, but these errors were encountered: