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 ipaddr.c #103

Merged
merged 1 commit into from
Mar 28, 2017
Merged

Fix memory leak in ipaddr.c #103

merged 1 commit into from
Mar 28, 2017

Conversation

vlm
Copy link
Contributor

@vlm vlm commented Mar 25, 2017

No description provided.

@vlm vlm force-pushed the patch-3 branch 2 times, most recently from 47744b1 to 393b41a Compare March 25, 2017 00:44
@sustrik
Copy link
Owner

sustrik commented Mar 25, 2017

I wouldn't mess with dns.c as that's a third party library. If you want to upstream the patch, the repo is here:

https://github.com/wahern/dns

I've even filled a ticket about the problem:

wahern/dns#17

However, it looks like dns_ai_nextent just mallocs the item, so maybe the user is expected to free it manually and everything is working as expected. (The documentation is kind of lacking.)

At the moment I would just add free(ent) statements to ipaddr.c wherever needed.

@vlm
Copy link
Contributor Author

vlm commented Mar 25, 2017

Found a better way, check it out.

@vlm vlm force-pushed the patch-3 branch 2 times, most recently from c71cb6e to e926d64 Compare March 25, 2017 18:40
ipaddr.c Outdated
ipv6 = it;
it = NULL;
}
if(it) freeaddrinfo(it); /* Ended up useless */
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Note that unlike free(), freeaddrinfo() can't work on NULLs.

@sustrik sustrik merged commit 948f445 into sustrik:master Mar 28, 2017
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