1
0
mirror of https://gitlab.com/libvirt/libvirt.git synced 2024-12-25 01:34:11 +03:00

macvtap: avoid invalid free

Commit 0472f39 plugged a leak, but introduced another bug:

Actually looks like physfndev is conditionally allocated in getPhysfnDev
Its better to modify getPhysfnDev to allocate physfndev every time.
This commit is contained in:
Roopa Prabhu 2011-10-14 13:41:46 -07:00 committed by Eric Blake
parent 4040ff6638
commit 80b077ee5e

View File

@ -964,7 +964,11 @@ getPhysfnDev(const char *linkdev,
*/
*vf = PORT_SELF_VF;
*physfndev = (char *)linkdev;
*physfndev = strdup(linkdev);
if (!*physfndev) {
virReportOOMError();
rc = -1;
}
}
return rc;