Skip to content

Fix memory leak in posix_ttyname() #10190

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

Closed
wants to merge 1 commit into from

Conversation

Girgias
Copy link
Member

@Girgias Girgias commented Dec 30, 2022

Not sure how to write a test case for this.

The other thing I don't get is why we only use ttyname_r() in ZTS builds.

Copy link
Member

@cmb69 cmb69 left a comment

Choose a reason for hiding this comment

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

Ah, good catch! Not sure about the test case, but if in doubt, we can leave that out.

The other thing I don't get is why we only use ttyname_r() in ZTS builds.

Well, we use ttyname_r() on in ZTS builds, if it is available. Otherwise we're falling back to ttyname which is apparently available everywhere. Using the reentrant function is not necessary for NTS builds, and likely a bit more performant (might not need to allocate memory under the hood).

@Girgias Girgias closed this in c2b0be5 Dec 30, 2022
@Girgias Girgias deleted the posix-memleak-81 branch December 30, 2022 16:44
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.

2 participants