Re: [PATCH] ALSA: pci: Fix memory leak in snd_korg1212_create

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



…
> +++ b/sound/pci/korg1212/korg1212.c
…
> @@ -2398,8 +2403,10 @@ static int snd_korg1212_create(struct snd_card *card, struct pci_dev *pci,
>
>          for (i = 0; i < ARRAY_SIZE(snd_korg1212_controls); i++) {
>                  err = snd_ctl_add(korg1212->card, snd_ctl_new1(&snd_korg1212_controls[i], korg1212));
> -                if (err < 0)
> +		if (err < 0) {
> +			snd_korg1212_free(korg1212);
>                          return err;
> +		}

I suggest to add a jump target according to the Linux coding style
so that duplicate exception handling code can be reduced.

 	return 0;

+free_korg:
+	snd_korg1212_free(korg1212);
+	return err;
 }


Regards,
Markus
_______________________________________________
Alsa-devel mailing list
Alsa-devel@xxxxxxxxxxxxxxxx
https://mailman.alsa-project.org/mailman/listinfo/alsa-devel




[Index of Archives]     [ALSA User]     [Linux Audio Users]     [Pulse Audio]     [Kernel Archive]     [Asterisk PBX]     [Photo Sharing]     [Linux Sound]     [Video 4 Linux]     [Gimp]     [Yosemite News]

  Powered by Linux