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;