usb: gadget: f_midi: fix leak on failed to enqueue out requests
authorFelipe F. Tonello <eu@felipetonello.com>
Tue, 10 Nov 2015 17:52:06 +0000 (17:52 +0000)
committerFelipe Balbi <balbi@ti.com>
Thu, 19 Nov 2015 20:48:50 +0000 (14:48 -0600)
This patch fixes a memory leak that occurs when an endpoint fails to enqueue
the request. If that happens the complete function will never be called, thus
never freeing the request.

Signed-off-by: Felipe F. Tonello <eu@felipetonello.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
drivers/usb/gadget/function/f_midi.c

index 7877aa8e2aec54ec0b7bb80de1e82012e4556780..898a570319f17c3128b7a44878ebc09ea7242961 100644 (file)
@@ -370,6 +370,7 @@ static int f_midi_set_alt(struct usb_function *f, unsigned intf, unsigned alt)
                if (err) {
                        ERROR(midi, "%s queue req: %d\n",
                                    midi->out_ep->name, err);
+                       free_ep_req(midi->out_ep, req);
                }
        }