From: Tom Rini Date: Sat, 12 Sep 2015 08:51:10 -0400 Subject: [U-Boot] [U-Boot, 01/10] usb: gadget: don't leak configs when unbinding In-Reply-To: <1441425831-3441-1-git-send-email-swarren@wwwdotorg.org> References: <1441425831-3441-1-git-send-email-swarren@wwwdotorg.org> Message-ID: <20150912125110.GY26226@bill-the-cat> List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: u-boot@lists.denx.de On Fri, Sep 04, 2015 at 10:03:42PM -0600, Stephen Warren wrote: > From: Stephen Warren > > By the time g_dnl_unbind() is run, cdev->config has been set to NULL, > so the free() there does nothing, and the config struct is leaked. > Equally, struct usb_gadget contains a linked list of config structs, so > the code should iterate over them all and free each one, rather than > freeing one particular config struct. > > composite_unbind() already iterates over the list of config structs, and > unlinks each from the linked list. Fix this loop to free() each struct as > it's unlinked and otherwise forgotten. > > Signed-off-by: Stephen Warren > Acked-by: Lukasz Majewski > Tested-by: Lukasz Majewski Applied to u-boot/master, thanks! -- Tom -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 836 bytes Desc: Digital signature URL: