usb: qcserial add missing errorpath kfrees
authorSteven Hardy <shardy@redhat.com>
Mon, 4 Apr 2011 17:02:25 +0000 (18:02 +0100)
committerGreg Kroah-Hartman <gregkh@suse.de>
Wed, 13 Apr 2011 22:53:16 +0000 (15:53 -0700)
There are two -ENODEV error paths in qcprobe where the allocated private
data is not freed, this patch adds the two missing kfrees to avoid
leaking memory on the error path

Signed-off-by: Steven Hardy <shardy@redhat.com>
Cc: stable <stable@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
drivers/usb/serial/qcserial.c

index cd638648479adfc7dbee31e877ebea3531e38a9c..54a9dab1f33b4e4d335201d04572499ab701c424 100644 (file)
@@ -167,6 +167,7 @@ static int qcprobe(struct usb_serial *serial, const struct usb_device_id *id)
                                        "Could not set interface, error %d\n",
                                        retval);
                                retval = -ENODEV;
+                               kfree(data);
                        }
                } else if (ifnum == 2) {
                        dbg("Modem port found");
@@ -191,6 +192,7 @@ static int qcprobe(struct usb_serial *serial, const struct usb_device_id *id)
                                        "Could not set interface, error %d\n",
                                        retval);
                                retval = -ENODEV;
+                               kfree(data);
                        }
                }
                break;