dm: pci: Avoid a memory leak when allocating the ROM
authorSimon Glass <sjg@chromium.org>
Fri, 15 Jan 2016 12:23:22 +0000 (05:23 -0700)
committerTom Rini <trini@konsulko.com>
Fri, 15 Jan 2016 13:09:44 +0000 (08:09 -0500)
commitd830b1520a720a19e4bbaa3d928e85115429c132
tree99a5f27167409762e4ad976a8482bb0adee778f6
parentf19345b51c98bb2bdd54e0275a7a223e91dbd6bb
dm: pci: Avoid a memory leak when allocating the ROM

Adjust pci_rom_load() to return an indication of whether it allocated
memory or not. Adjust the caller to free it. This fixes a memory leak
when PCI_VGA_RAM_IMAGE_START is not used.

Reported-by: Coverity (CID: 134194)
Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Tom Rini <trini@konsulko.com>
drivers/pci/pci_rom.c