diff options
| author | Takashi Sakamoto <o-takashi@sakamocchi.jp> | 2018-09-17 04:25:24 -0400 |
|---|---|---|
| committer | Takashi Iwai <tiwai@suse.de> | 2018-09-17 07:36:54 -0400 |
| commit | b1fbebd4164b3d170ad916dcd692cf843c9c065d (patch) | |
| tree | da51dd2421493b5256b09888f9caf46406814e04 | |
| parent | 37a3a98ef601f89100e3bb657fb0e190b857028c (diff) | |
ALSA: bebob: fix memory leak for M-Audio FW1814 and ProjectMix I/O at error path
After allocating model-dependent data for M-Audio FW1814 and ProjectMix
I/O, ALSA bebob driver has memory leak at error path.
This commit releases the allocated data at the error path.
Fixes: 04a2c73c97eb('ALSA: bebob: delayed registration of sound card')
Cc: <stable@vger.kernel.org> # v4.7+
Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
| -rw-r--r-- | sound/firewire/bebob/bebob.c | 2 | ||||
| -rw-r--r-- | sound/firewire/bebob/bebob_maudio.c | 4 |
2 files changed, 2 insertions, 4 deletions
diff --git a/sound/firewire/bebob/bebob.c b/sound/firewire/bebob/bebob.c index 730ea91d9be8..93676354f87f 100644 --- a/sound/firewire/bebob/bebob.c +++ b/sound/firewire/bebob/bebob.c | |||
| @@ -263,6 +263,8 @@ do_registration(struct work_struct *work) | |||
| 263 | error: | 263 | error: |
| 264 | mutex_unlock(&devices_mutex); | 264 | mutex_unlock(&devices_mutex); |
| 265 | snd_bebob_stream_destroy_duplex(bebob); | 265 | snd_bebob_stream_destroy_duplex(bebob); |
| 266 | kfree(bebob->maudio_special_quirk); | ||
| 267 | bebob->maudio_special_quirk = NULL; | ||
| 266 | snd_card_free(bebob->card); | 268 | snd_card_free(bebob->card); |
| 267 | dev_info(&bebob->unit->device, | 269 | dev_info(&bebob->unit->device, |
| 268 | "Sound card registration failed: %d\n", err); | 270 | "Sound card registration failed: %d\n", err); |
diff --git a/sound/firewire/bebob/bebob_maudio.c b/sound/firewire/bebob/bebob_maudio.c index 0c5a4cbb99ba..c266997ad299 100644 --- a/sound/firewire/bebob/bebob_maudio.c +++ b/sound/firewire/bebob/bebob_maudio.c | |||
| @@ -294,10 +294,6 @@ snd_bebob_maudio_special_discover(struct snd_bebob *bebob, bool is1814) | |||
| 294 | bebob->midi_output_ports = 2; | 294 | bebob->midi_output_ports = 2; |
| 295 | } | 295 | } |
| 296 | end: | 296 | end: |
| 297 | if (err < 0) { | ||
| 298 | kfree(params); | ||
| 299 | bebob->maudio_special_quirk = NULL; | ||
| 300 | } | ||
| 301 | mutex_unlock(&bebob->mutex); | 297 | mutex_unlock(&bebob->mutex); |
| 302 | return err; | 298 | return err; |
| 303 | } | 299 | } |
