[PATCH 04/13] qemuMonitorJSONGetMigrationStats: Don't clear @stats on failure

Michal Privoznik mprivozn at redhat.com
Mon Oct 25 10:57:28 UTC 2021


In the qemuMonitorJSONGetMigrationStats() there's a code under
cleanup label that's clearing returned @stats if the function
returns with an error. However, transitively there's just one
caller - qemuMigrationAnyFetchStats() - and it doesn't care for
this behaviour. Drop the code to simplify the cleanup label.

Signed-off-by: Michal Privoznik <mprivozn at redhat.com>
---
 src/qemu/qemu_monitor_json.c | 2 --
 1 file changed, 2 deletions(-)

diff --git a/src/qemu/qemu_monitor_json.c b/src/qemu/qemu_monitor_json.c
index 7833038a06..bcbb4e59ab 100644
--- a/src/qemu/qemu_monitor_json.c
+++ b/src/qemu/qemu_monitor_json.c
@@ -3542,8 +3542,6 @@ int qemuMonitorJSONGetMigrationStats(qemuMonitor *mon,
 
     ret = 0;
  cleanup:
-    if (ret < 0)
-        memset(stats, 0, sizeof(*stats));
     virJSONValueFree(cmd);
     virJSONValueFree(reply);
     return ret;
-- 
2.32.0




More information about the libvir-list mailing list