diff options
author | Dan Carpenter <dan.carpenter@oracle.com> | 2011-10-18 02:25:34 -0400 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@suse.de> | 2011-10-18 16:51:35 -0400 |
commit | 0f8fd43c42f2cc249943be76a4db0d058c16b6dc (patch) | |
tree | 247334d2cb84c610b1bc4471447311afd7ddfaa9 /drivers/usb | |
parent | 0889551267e7b6b4d27dc9f726f3d0cb0d976105 (diff) |
USB: gadget: midi: memory leak in f_midi_bind_config()
There is a small memory leak on the error paths.
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'drivers/usb')
-rw-r--r-- | drivers/usb/gadget/f_midi.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/drivers/usb/gadget/f_midi.c b/drivers/usb/gadget/f_midi.c index ef1bc7a174ef..67b222908cf9 100644 --- a/drivers/usb/gadget/f_midi.c +++ b/drivers/usb/gadget/f_midi.c | |||
@@ -951,7 +951,7 @@ int __init f_midi_bind_config(struct usb_configuration *c, | |||
951 | struct gmidi_in_port *port = kzalloc(sizeof(*port), GFP_KERNEL); | 951 | struct gmidi_in_port *port = kzalloc(sizeof(*port), GFP_KERNEL); |
952 | if (!port) { | 952 | if (!port) { |
953 | status = -ENOMEM; | 953 | status = -ENOMEM; |
954 | goto fail; | 954 | goto setup_fail; |
955 | } | 955 | } |
956 | 956 | ||
957 | port->midi = midi; | 957 | port->midi = midi; |
@@ -989,6 +989,8 @@ int __init f_midi_bind_config(struct usb_configuration *c, | |||
989 | return 0; | 989 | return 0; |
990 | 990 | ||
991 | setup_fail: | 991 | setup_fail: |
992 | for (--i; i >= 0; i--) | ||
993 | kfree(midi->in_port[i]); | ||
992 | kfree(midi); | 994 | kfree(midi); |
993 | fail: | 995 | fail: |
994 | return status; | 996 | return status; |