Skip to content

Commit

Permalink
Merge PR mumble-voip#4916: FIX(client): Memory leak in ALSA implement…
Browse files Browse the repository at this point in the history
…ation

The functions snd_card_get_name and snd_card_get_longname allocate a
String for the caller that needs to be freed once it is no longer needed.
This was not done in the current implementation and thus this was causing
a memory leak.

This commit fixes this by explicitly freeing the resources after usage.

Fixes mumble-voip#4910

Ref: alsa-project.org/alsa-doc/alsa-lib/group___control.html#ga547dcead4a72f24db4a0f9f530f75228
  • Loading branch information
Krzmbrzl authored Apr 6, 2021
2 parents 9b070db + 7c5188a commit 6e0ab7a
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/mumble/ALSAAudio.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -252,8 +252,10 @@ ALSAEnumerator::ALSAEnumerator() {
}
snd_pcm_info_free(info);
snd_ctl_close(ctl);
free(cname);
}
snd_card_next(&card);
free(name);
}
#endif
}
Expand Down

0 comments on commit 6e0ab7a

Please sign in to comment.