[alsa-devel] [PATCH 02/16] ALSA: line6: Fix memory leak at probe error path

Chris Rorvick chris at rorvick.com
Sun Jan 25 09:06:19 CET 2015


On Fri, Jan 23, 2015 at 11:13 AM, Takashi Iwai <tiwai at suse.de> wrote:
> --- a/sound/usb/line6/driver.c
> +++ b/sound/usb/line6/driver.c
> @@ -507,10 +507,32 @@ int line6_probe(struct usb_interface *interface,
>         int interface_number;
>         int ret;
>
> +       ret = snd_card_new(line6->ifcdev,
> +                          SNDRV_DEFAULT_IDX1, SNDRV_DEFAULT_STR1,
> +                          THIS_MODULE, 0, &card);

The `ifcdev' member has not been initialized yet.  You need something
like the following squashed in:

>8------------------------------------------------------8<
diff --git a/sound/usb/line6/driver.c b/sound/usb/line6/driver.c
index 2eed6fb..25d6b0f 100644
--- a/sound/usb/line6/driver.c
+++ b/sound/usb/line6/driver.c
@@ -507,6 +507,11 @@ int line6_probe(struct usb_interface *interface,
        int interface_number;
        int ret;

+       /* store basic data: */
+       line6->properties = properties;
+       line6->usbdev = usbdev;
+       line6->ifcdev = &interface->dev;
+
        ret = snd_card_new(line6->ifcdev,
                           SNDRV_DEFAULT_IDX1, SNDRV_DEFAULT_STR1,
                           THIS_MODULE, 0, &card);
@@ -548,11 +553,6 @@ int line6_probe(struct usb_interface *interface,
                goto error;
        }

-       /* store basic data: */
-       line6->properties = properties;
-       line6->usbdev = usbdev;
-       line6->ifcdev = &interface->dev;
-
        line6_get_interval(line6);

        if (properties->capabilities & LINE6_CAP_CONTROL) {


More information about the Alsa-devel mailing list