提交 2444c411 编写于 作者: M Michal Privoznik 提交者: Laine Stump

network: Fix NULL dereference during error recovery

This fixes: https://bugzilla.redhat.com/show_bug.cgi?id=696660

While starting a network, if brSetForwardDelay() fails, we go to err1
where we want to access macTapIfName variable which was just
VIR_FREE'd a few lines above. Instead, keep macTapIfName until we are
certain of success.
上级 1ef5a3d3
......@@ -1616,7 +1616,7 @@ networkStartNetworkDaemon(struct network_driver *driver,
bool v4present = false, v6present = false;
virErrorPtr save_err = NULL;
virNetworkIpDefPtr ipdef;
char *macTapIfName;
char *macTapIfName = NULL;
if (virNetworkObjIsActive(network)) {
networkReportError(VIR_ERR_OPERATION_INVALID,
......@@ -1657,7 +1657,6 @@ networkStartNetworkDaemon(struct network_driver *driver,
VIR_FREE(macTapIfName);
goto err0;
}
VIR_FREE(macTapIfName);
}
/* Set bridge options */
......@@ -1731,6 +1730,7 @@ networkStartNetworkDaemon(struct network_driver *driver,
goto err5;
}
VIR_FREE(macTapIfName);
VIR_INFO(_("Starting up network '%s'"), network->def->name);
network->active = 1;
......@@ -1778,6 +1778,7 @@ networkStartNetworkDaemon(struct network_driver *driver,
macTapIfName, network->def->bridge,
virStrerror(err, ebuf, sizeof ebuf));
}
VIR_FREE(macTapIfName);
err0:
if (!save_err)
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册