Commit cea37f87519ca3172a4e8ddd3ffcd2b4232b341f

Authored by Daeseok Youn
Committed by David Vrabel
1 parent 4461bbc05b

xen: fix memory leak in __xen_pcibk_add_pci_dev()

It need to free dev_entry when it failed to assign to a new
slot on the virtual PCI bus.

smatch says:
 drivers/xen/xen-pciback/vpci.c:142 __xen_pcibk_add_pci_dev() warn:
possible memory leak of 'dev_entry'

Signed-off-by: Daeseok Youn <daeseok.youn@gmail.com>
Signed-off-by: David Vrabel <david.vrabel@citrix.com>

Showing 1 changed file with 2 additions and 0 deletions Side-by-side Diff

drivers/xen/xen-pciback/vpci.c
... ... @@ -137,6 +137,8 @@
137 137 /* Publish this device. */
138 138 if (!err)
139 139 err = publish_cb(pdev, 0, 0, PCI_DEVFN(slot, func), devid);
  140 + else
  141 + kfree(dev_entry);
140 142  
141 143 out:
142 144 return err;