From e9d4912cc0e94064bc1b1d8879670fb23e68d68a Mon Sep 17 00:00:00 2001 From: Syed Humaid Date: Wed, 17 Apr 2019 08:11:06 +0400 Subject: [PATCH] network: Convert to virErrorRestore/virErrorPreserveLast Replaced usage of virSaveLastError and virSetError/virFreeError with virErrorPreserveLast and virErrorRestore respectively. Signed-off-by: Syed Humaid --- 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 8b36376761..ce4f4890f1 100644 --- a/src/network/bridge_driver.c +++ b/src/network/bridge_driver.c @@ -2498,7 +2498,7 @@ networkStartNetworkVirtual(virNetworkDriverStatePtr driver, err4: if (!save_err) - save_err = virSaveLastError(); + virErrorPreserveLast(&save_err); dnsmasqPid = virNetworkObjGetDnsmasqPid(obj); if (dnsmasqPid > 0) { @@ -2508,18 +2508,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); @@ -2531,13 +2531,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; } -- GitLab