usb: gadget: function: printer: Fix a memory leak for interface descriptor
PATCH 1/1 usb: gadget: function: printer: Fix a memory leak for interface descriptor
From: Zqiang <[email protected]>
When printer driver be load, the printer_func_bind function be called, in this function, the interface descriptor be allocated memory, if after that, the error occurred, the interface descriptor memory need to be free.
--- drivers/usb/gadget/function/f_printer.c | 1 + 1 file changed, 1 insertion(+)
drivers/usb/gadget/function/f_printer.c +1 -0
@@ -1162,6 +1162,7 @@ static int printer_func_bind(struct usb_configuration *c,printer_req_free (dev->in_ep, req); } +usb_free_all_descriptors (f);return ret; }
Signature · 1 line
2.17.1
Quoted 3 lines · On 20-12-09 11:00:18, [email protected] wrote:
From: Zqiang <[email protected]>
When printer driver be load, the
printer_func_bindfunction be called, in
is loaded is called
Quoted 1 line
this function, the interface descriptor be allocated memory, if after that,
descriptors memory region are allocated
Quoted 1 line
the error occurred, the interface descriptor memory need to be free.
occurs,
Except Typo, otherwise:
Besides, it is bug-fix, you could add fixes tag, and cc [email protected].
Peter
Quoted 21 lines
Signed-off-by Zqiang <[email protected]>--- drivers/usb/gadget/function/f_printer.c | 1 + 1 file changed, 1 insertion(+)drivers/usb/gadget/function/f_printer.c +1
-0@@ -1162,6 +1162,7 @@ static int printer_func_bind(struct usb_configuration *c,printer_req_free (dev->in_ep, req); } +usb_free_all_descriptors (f);return ret; }Signature · 1 line
2.17.1
Signature · 2 lines
Thanks, Peter Chen