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 memory leak in WrappedText #4043

Closed
wants to merge 2 commits into from

Conversation

louist103
Copy link
Contributor

@louist103 louist103 commented Apr 7, 2024

This function allocated memory with _strdup and was never freed.

Build Artifacts

@Archez
Copy link
Contributor

Archez commented Apr 7, 2024

Do we really need to use strdup in the first place?
I think we could just update the WrappedText helper method to return std::string and then just invoke .c_str() off the return value for the ImGui methods, then the std::string will just be cleaned up when scope exits. Seems better than having to remember to call free (which there is a usage of WrappedText in the SaveEditor missing a free as well).

@briaguya-ai
Copy link
Contributor

i'm down to switch to using std::string. also, can this point to macready?

Copy link
Contributor

@briaguya-ai briaguya-ai left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

let's wait to merge this until it's doing it the std::string way

@briaguya-ai
Copy link
Contributor

closing in favor of #4144

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.

3 participants