ALSA: oxfw: fix memory leak for model-dependent data at error path
authorTakashi Sakamoto <o-takashi@sakamocchi.jp>
Mon, 17 Sep 2018 08:26:08 +0000 (17:26 +0900)
committerTakashi Iwai <tiwai@suse.de>
Mon, 17 Sep 2018 11:40:09 +0000 (13:40 +0200)
After allocating model-dependent data, ALSA OXFW driver has memory leak
of the data at error path.

This commit releases the data at the error path.

Fixes: 6c29230e2a5f ('ALSA: oxfw: 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>
sound/firewire/oxfw/oxfw.c

index fd34ef2ac6796da6f387a044a9e8cb3f30a3c7ca..75c6ba2fe3dc7eaa23bcdf2df36bd77c2b32a5f8 100644 (file)
@@ -271,6 +271,8 @@ error:
        if (oxfw->has_output)
                snd_oxfw_stream_destroy_simplex(oxfw, &oxfw->tx_stream);
        snd_card_free(oxfw->card);
+       kfree(oxfw->spec);
+       oxfw->spec = NULL;
        dev_info(&oxfw->unit->device,
                 "Sound card registration failed: %d\n", err);
 }