ALSA: hda - Fix memory leaks at error path in patch_cirrus.c
authorTakashi Iwai <tiwai@suse.de>
Wed, 10 Oct 2012 06:50:35 +0000 (08:50 +0200)
committerBen Hutchings <ben@decadent.org.uk>
Tue, 30 Oct 2012 23:26:41 +0000 (23:26 +0000)
commit c5e0b6dbad9b4d18c561af90b384d02373f1c994 upstream.

The proper destructor should be called at the error path.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
[bwh: Backported to 3.2: drop the change to nonexistent patch_cs4213()]
Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
sound/pci/hda/patch_cirrus.c

index ec0518e..e449278 100644 (file)
@@ -1404,7 +1404,7 @@ static int patch_cs420x(struct hda_codec *codec)
        return 0;
 
  error:
        return 0;
 
  error:
-       kfree(codec->spec);
+       cs_free(codec);
        codec->spec = NULL;
        return err;
 }
        codec->spec = NULL;
        return err;
 }
@@ -1949,7 +1949,7 @@ static int patch_cs421x(struct hda_codec *codec)
        return 0;
 
  error:
        return 0;
 
  error:
-       kfree(codec->spec);
+       cs_free(codec);
        codec->spec = NULL;
        return err;
 }
        codec->spec = NULL;
        return err;
 }