Skip to content

Commit

Permalink
ALSA: oxfw: fix memory leak of discovered stream formats at error path
Browse files Browse the repository at this point in the history
After finishing discover of stream formats, ALSA OXFW driver has memory
leak of allocated memory object at error path.

This commit releases the memory object at the error path.

Fixes: 6c29230 ('ALSA: oxfw: delayed registration of sound card')
Cc: <[email protected]> # v4.7+
Signed-off-by: Takashi Sakamoto <[email protected]>
Signed-off-by: Takashi Iwai <[email protected]>
  • Loading branch information
takaswie authored and tiwai committed Sep 17, 2018
1 parent ce925f0 commit 1064bc6
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions sound/firewire/oxfw/oxfw.c
Original file line number Diff line number Diff line change
Expand Up @@ -208,6 +208,7 @@ static int detect_quirks(struct snd_oxfw *oxfw)
static void do_registration(struct work_struct *work)
{
struct snd_oxfw *oxfw = container_of(work, struct snd_oxfw, dwork.work);
int i;
int err;

if (oxfw->registered)
Expand Down Expand Up @@ -270,6 +271,12 @@ static void do_registration(struct work_struct *work)
snd_oxfw_stream_destroy_simplex(oxfw, &oxfw->rx_stream);
if (oxfw->has_output)
snd_oxfw_stream_destroy_simplex(oxfw, &oxfw->tx_stream);
for (i = 0; i < SND_OXFW_STREAM_FORMAT_ENTRIES; ++i) {
kfree(oxfw->tx_stream_formats[i]);
oxfw->tx_stream_formats[i] = NULL;
kfree(oxfw->rx_stream_formats[i]);
oxfw->rx_stream_formats[i] = NULL;
}
snd_card_free(oxfw->card);
kfree(oxfw->spec);
oxfw->spec = NULL;
Expand Down

0 comments on commit 1064bc6

Please sign in to comment.