* [patch 2/2 -next] USB: gadget: midi: memory leak in
@ 2011-10-18 6:25 Dan Carpenter
0 siblings, 0 replies; only message in thread
From: Dan Carpenter @ 2011-10-18 6:25 UTC (permalink / raw)
To: kernel-janitors
There is a small memory leak on the error paths.
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
diff --git a/drivers/usb/gadget/f_midi.c b/drivers/usb/gadget/f_midi.c
index ef1bc7a..67b2229 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,
struct gmidi_in_port *port = kzalloc(sizeof(*port), GFP_KERNEL);
if (!port) {
status = -ENOMEM;
- goto fail;
+ goto setup_fail;
}
port->midi = midi;
@@ -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;
^ permalink raw reply related [flat|nested] only message in thread
only message in thread, other threads:[~2011-10-18 6:25 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-10-18 6:25 [patch 2/2 -next] USB: gadget: midi: memory leak in Dan Carpenter
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox