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 candidates memory leaks #2288

Merged
merged 2 commits into from
Jul 20, 2020
Merged

Conversation

fancycode
Copy link
Contributor

  • Ignored peer-reflexive candidates were not released.
  • All found local candidates after the one that was used were leaking.

@lminiero
Copy link
Member

Good catch, I thought nice_agent_get_local_candidates only allocated the list, but looking at the documentation it looks like the caller owns the candidate objects too. I wonder if this changed recently, though? I wouldn't want this to crash instances with older versions of libnice.

@fancycode
Copy link
Contributor Author

I don't think this is something new in libnice, most of the candidates returned by nice_agent_get_local_candidates were already freed in the existing code, e.g. here:

nice_candidate_free(c);

nice_candidate_free(c);

@lminiero
Copy link
Member

Ack, makes sense, merging then! Thanks 👍

@lminiero lminiero merged commit 7c41b0e into meetecho:master Jul 20, 2020
@fancycode fancycode deleted the candidates-leaks branch July 20, 2020 11:36
bartbalaz pushed a commit to bartbalaz/janus-gateway that referenced this pull request Jul 21, 2020
* Free ignored peer-reflexive candidates.
* Release non-matching candidates after found candidate.
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.

None yet

2 participants