From: Dongjiu Geng <gengdong...@huawei.com>
Committer: Nadav Har'El <n...@scylladb.com>
Branch: master

pci-generic: free the device pointer when parse device config failure

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>
Message-Id: <1500877699-12208-1-git-send-email-gengdong...@huawei.com>

---
diff --git a/drivers/pci-generic.cc b/drivers/pci-generic.cc
--- 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;
             }

--
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