Skip to content

Commit

Permalink
USB: gadget: midi: memory leak in f_midi_bind_config()
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Dan Carpenter authored and Greg Kroah-Hartman committed Oct 18, 2011
1 parent 0889551 commit 0f8fd43
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion drivers/usb/gadget/f_midi.c
Original file line number Diff line number Diff line change
Expand Up @@ -951,7 +951,7 @@ int __init f_midi_bind_config(struct usb_configuration *c,
struct gmidi_in_port *port = kzalloc(sizeof(*port), GFP_KERNEL);
if (!port) {
status = -ENOMEM;
goto fail;
goto setup_fail;
}

port->midi = midi;
Expand Down Expand Up @@ -989,6 +989,8 @@ int __init f_midi_bind_config(struct usb_configuration *c,
return 0;

setup_fail:
for (--i; i >= 0; i--)
kfree(midi->in_port[i]);
kfree(midi);
fail:
return status;
Expand Down

0 comments on commit 0f8fd43

Please sign in to comment.