Skip to content

Commit cea37f8

Browse files
daeseokyounDavid Vrabel
authored andcommitted
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 <[email protected]> Signed-off-by: David Vrabel <[email protected]>
1 parent 4461bbc commit cea37f8

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

drivers/xen/xen-pciback/vpci.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -137,6 +137,8 @@ static int __xen_pcibk_add_pci_dev(struct xen_pcibk_device *pdev,
137137
/* Publish this device. */
138138
if (!err)
139139
err = publish_cb(pdev, 0, 0, PCI_DEVFN(slot, func), devid);
140+
else
141+
kfree(dev_entry);
140142

141143
out:
142144
return err;

0 commit comments

Comments
 (0)