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

Memory leaks in xmppipe_send_message() #3

Closed
pasis opened this issue Jun 11, 2019 · 1 comment
Closed

Memory leaks in xmppipe_send_message() #3

pasis opened this issue Jun 11, 2019 · 1 comment

Comments

@pasis
Copy link
Contributor

pasis commented Jun 11, 2019

xmpp_stanza_new() returns a stanza with reference count = 1. Every xmpp_stanza_add_child() acquires additional reference to the child stanza. Therefore, you need to release a reference to the child after the xmpp_stanza_add_child(), otherwise, xmpp_stanza_release(message) will free only the message stanza, but body and text will remain allocated.

To reduce such a kind of errors, you can use stanza helpers like xmpp_message_new() and xmpp_message_set_body().

@msantos
Copy link
Owner

msantos commented Jun 12, 2019

Thank you for letting me know and taking the time to explain the problem, really appreciate it. I'll look into fixing it as you suggest.

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

2 participants