]> git.ozlabs.org Git - petitboot/commit
lib/flash: fix resource leak in flash_setup_buffer() error paths
authorAndrew Donnellan <andrew.donnellan@au1.ibm.com>
Wed, 4 May 2016 01:22:57 +0000 (11:22 +1000)
committerSamuel Mendoza-Jonas <sam@mendozajonas.com>
Fri, 6 May 2016 03:57:30 +0000 (13:57 +1000)
commit87fa4885310b6c6b79e31d79d192ba9ea90cf236
tree306127e71829d8e2119d5a9f31c941bf0ce9f185
parent81f28af2bd94cc552aef1a7b959e4c6b84457ce7
lib/flash: fix resource leak in flash_setup_buffer() error paths

Some error paths in flash_setup_buffer() fail to free the flash_info struct
or close the open ffs before they return. Change them to goto the cleanup
code at the end. Separate the cleanup code into separate labels depending
on whether we need to call ffs_close(), arch_flash_close() and
talloc_free().

Signed-off-by: Andrew Donnellan <andrew.donnellan@au1.ibm.com>
Signed-off-by: Samuel Mendoza-Jonas <sam@mendozajonas.com>
lib/flash/flash.c