Skip to content

Commit 1064bc6

Browse files
takaswietiwai
authored andcommitted
ALSA: oxfw: fix memory leak of discovered stream formats at error path
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]>
1 parent ce925f0 commit 1064bc6

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

sound/firewire/oxfw/oxfw.c

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -208,6 +208,7 @@ static int detect_quirks(struct snd_oxfw *oxfw)
208208
static void do_registration(struct work_struct *work)
209209
{
210210
struct snd_oxfw *oxfw = container_of(work, struct snd_oxfw, dwork.work);
211+
int i;
211212
int err;
212213

213214
if (oxfw->registered)
@@ -270,6 +271,12 @@ static void do_registration(struct work_struct *work)
270271
snd_oxfw_stream_destroy_simplex(oxfw, &oxfw->rx_stream);
271272
if (oxfw->has_output)
272273
snd_oxfw_stream_destroy_simplex(oxfw, &oxfw->tx_stream);
274+
for (i = 0; i < SND_OXFW_STREAM_FORMAT_ENTRIES; ++i) {
275+
kfree(oxfw->tx_stream_formats[i]);
276+
oxfw->tx_stream_formats[i] = NULL;
277+
kfree(oxfw->rx_stream_formats[i]);
278+
oxfw->rx_stream_formats[i] = NULL;
279+
}
273280
snd_card_free(oxfw->card);
274281
kfree(oxfw->spec);
275282
oxfw->spec = NULL;

0 commit comments

Comments
 (0)