提交 80b077ee 编写于 作者: R Roopa Prabhu 提交者: Eric Blake

macvtap: avoid invalid free

Commit 0472f39f 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.
上级 4040ff66
...@@ -964,7 +964,11 @@ getPhysfnDev(const char *linkdev, ...@@ -964,7 +964,11 @@ getPhysfnDev(const char *linkdev,
*/ */
*vf = PORT_SELF_VF; *vf = PORT_SELF_VF;
*physfndev = (char *)linkdev; *physfndev = strdup(linkdev);
if (!*physfndev) {
virReportOOMError();
rc = -1;
}
} }
return rc; return rc;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册