[coreboot-gerrit] Change in coreboot[master]: libpayload/drivers/usb: Fix leaks

Nico Huber (Code Review) gerrit at coreboot.org
Sat Feb 10 15:00:39 CET 2018


Nico Huber has posted comments on this change. ( https://review.coreboot.org/23689 )

Change subject: libpayload/drivers/usb: Fix leaks
......................................................................


Patch Set 1:

(3 comments)

https://review.coreboot.org/#/c/23689/1/payloads/libpayload/drivers/usb/usb.c
File payloads/libpayload/drivers/usb/usb.c:

https://review.coreboot.org/#/c/23689/1/payloads/libpayload/drivers/usb/usb.c@673
PS1, Line 673: 	if (dev->descriptor)
No need to check for NULL, free(NULL); is valid.


https://review.coreboot.org/#/c/23689/1/payloads/libpayload/drivers/usb/usb.c@675
PS1, Line 675: 0
What's wrong with NULL?


https://review.coreboot.org/#/c/23689/1/payloads/libpayload/drivers/usb/usb.c@673
PS1, Line 673: 	if (dev->descriptor)
             : 		free(dev->descriptor);
             : 	dev->descriptor = 0;
             : 	if (dev->configuration)
             : 		free(dev->configuration);
             : 	dev->configuration = 0;
IMO, this should be done after the call to ->destroy(). You
shouldn't have to repeat it in every implementation...



-- 
To view, visit https://review.coreboot.org/23689
To unsubscribe, or for help writing mail filters, visit https://review.coreboot.org/settings

Gerrit-Project: coreboot
Gerrit-Branch: master
Gerrit-MessageType: comment
Gerrit-Change-Id: Ib2d80dd4590aa0dacdf2da3b614c6505c931d0be
Gerrit-Change-Number: 23689
Gerrit-PatchSet: 1
Gerrit-Owner: Patrick Rudolph <siro at das-labor.org>
Gerrit-Reviewer: Julius Werner <jwerner at chromium.org>
Gerrit-Reviewer: Nico Huber <nico.h at gmx.de>
Gerrit-Reviewer: Patrick Georgi <pgeorgi at google.com>
Gerrit-Reviewer: build bot (Jenkins) <no-reply at coreboot.org>
Gerrit-Comment-Date: Sat, 10 Feb 2018 14:00:39 +0000
Gerrit-HasComments: Yes
Gerrit-HasLabels: No
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.coreboot.org/pipermail/coreboot-gerrit/attachments/20180210/b9e706e2/attachment.html>


More information about the coreboot-gerrit mailing list