]> xenbits.xensource.com Git - libvirt.git/commit
pci: eliminate memory leak in virPCIDeviceReattach
authorLaine Stump <laine@laine.org>
Tue, 4 Jun 2013 20:02:33 +0000 (16:02 -0400)
committerLaine Stump <laine@laine.org>
Mon, 24 Jun 2013 21:35:01 +0000 (17:35 -0400)
commitf962e8b6034c80f6887ee70a7dfcd80934121524
tree7b2d18d989426f0c95a499aa7e4023f82ed25bc2
parent50a8d8503539c2d25d10ae7666c7e5a35143f876
pci: eliminate memory leak in virPCIDeviceReattach

virPCIDeviceReattach was making the assumption that the dev object
given to it was one and the same with the dev object on the
inactiveDevs list. If that had been the case, it would not need to
free the dev object it removed from the inactive list, because the
caller of virPCIDeviceReattach always frees the dev object that it
passes in. Since the dev object passed in is *never* the same object
that's on the list (it is a different object with the same name and
attributes, created just for the purpose of searching for the actual
object), simply doing a "ListSteal" to remove the object from the list
results in one leaked object; we need to actually free the object
after removing it from the list.
src/util/virpci.c