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(client): Memory leak in ALSA implementation #4916

Merged
merged 1 commit into from Apr 6, 2021

Conversation

Zero0one1
Copy link
Contributor

@Zero0one1 Zero0one1 commented Apr 6, 2021

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 #4910

Ref: https://www.alsa-project.org/alsa-doc/alsa-lib/group___control.html#ga547dcead4a72f24db4a0f9f530f75228

Copy link
Member

@Krzmbrzl Krzmbrzl left a comment

Choose a reason for hiding this comment

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

Please reword your commit message to follow our commit guidelines.

In this case this should be something like

FIX(client): Memory leak in ALSA implementation

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 `free`ing the resources after usage.

Fixes #4910

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 `free`ing the resources after usage.

Fixes mumble-voip#4910

Co-Authored-By: Zero0one1 <summerlinasity@gmail.com>
Co-Authored-By: Krzmbrzl <krzmbrzl@gmail.com>
@Zero0one1 Zero0one1 reopened this Apr 6, 2021
@Zero0one1 Zero0one1 requested a review from Krzmbrzl April 6, 2021 08:52
@Krzmbrzl Krzmbrzl changed the title Free the allocated memory of snd_card_get_name() and snd_card_get_longname() FIX(client): Memory leak in ALSA implementation Apr 6, 2021
@Krzmbrzl Krzmbrzl added audio bug A bug (error) in the software client labels Apr 6, 2021
@Krzmbrzl Krzmbrzl merged commit 6e0ab7a into mumble-voip:master Apr 6, 2021
@Krzmbrzl
Copy link
Member

Krzmbrzl commented Apr 6, 2021

Thanks for the fix 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
audio bug A bug (error) in the software client
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Wrong usage of ALSA library API may cause a memory leak
2 participants