when parse device config failure, it will break out of the circulation
loop, but not free the allocated device pointer. so this patch free that
pointer to avoid memory leakage

Signed-off-by: Dongjiu Geng <gengdong...@huawei.com>
---
 drivers/pci-generic.cc | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/pci-generic.cc b/drivers/pci-generic.cc
index dd6b257..61e7a0f 100644
--- a/drivers/pci-generic.cc
+++ b/drivers/pci-generic.cc
@@ -88,6 +88,8 @@ bool check_bus(u16 bus)
             if (!parse_ok) {
                 pci_e("Error: couldn't parse device config space %02x:%02x.%x",
                         bus, slot, func);
+                // free the dev pointer to avoid memory leakage
+                delete dev;
                 break;
             }
 
-- 
2.10.1

-- 
You received this message because you are subscribed to the Google Groups "OSv 
Development" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to osv-dev+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to