Replaced usage of virSaveLastError and virSetError/virFreeError with
virErrorPreserveLast and virErrorRestore respectively.
Signed-off-by: Syed Humaid <syedhumaidbinharoon(a)gmail.com>
---
src/network/bridge_driver.c | 15 ++++++---------
1 file changed, 6 insertions(+), 9 deletions(-)
diff --git a/src/network/bridge_driver.c b/src/network/bridge_driver.c
index f824b8b4f3..dc21ac642c 100644
--- a/src/network/bridge_driver.c
+++ b/src/network/bridge_driver.c
@@ -2495,7 +2495,7 @@ networkStartNetworkVirtual(virNetworkDriverStatePtr driver,
err4:
if (!save_err)
- save_err = virSaveLastError();
+ virErrorPreserveLast(&save_err);
dnsmasqPid = virNetworkObjGetDnsmasqPid(obj);
if (dnsmasqPid > 0) {
@@ -2505,18 +2505,18 @@ networkStartNetworkVirtual(virNetworkDriverStatePtr driver,
err3:
if (!save_err)
- save_err = virSaveLastError();
+ virErrorPreserveLast(&save_err);
ignore_value(virNetDevSetOnline(def->bridge, 0));
err2:
if (!save_err)
- save_err = virSaveLastError();
+ virErrorPreserveLast(&save_err);
if (def->forward.type != VIR_NETWORK_FORWARD_OPEN)
networkRemoveFirewallRules(def);
err1:
if (!save_err)
- save_err = virSaveLastError();
+ virErrorPreserveLast(&save_err);
if (macTapIfName) {
VIR_FORCE_CLOSE(tapfd);
@@ -2528,13 +2528,10 @@ networkStartNetworkVirtual(virNetworkDriverStatePtr driver,
err0:
if (!save_err)
- save_err = virSaveLastError();
+ virErrorPreserveLast(&save_err);
ignore_value(virNetDevBridgeDelete(def->bridge));
- if (save_err) {
- virSetError(save_err);
- virFreeError(save_err);
- }
+ virErrorRestore(&save_err);
/* coverity[leaked_handle] - 'tapfd' is not leaked */
return -1;
}
--
2.20.1