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.... File payloads/libpayload/drivers/usb/usb.c:
https://review.coreboot.org/#/c/23689/1/payloads/libpayload/drivers/usb/usb.... 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.... PS1, Line 675: 0 What's wrong with NULL?
https://review.coreboot.org/#/c/23689/1/payloads/libpayload/drivers/usb/usb.... 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...