[PATCH] free memory properly in cleanup patch

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



virsh schedinfo inactive-domain will trigger the problem.
---
 daemon/remote.c |    7 +++++--
 1 files changed, 5 insertions(+), 2 deletions(-)

diff --git a/daemon/remote.c b/daemon/remote.c
index 1c98bba..eedbc77 100644
--- a/daemon/remote.c
+++ b/daemon/remote.c
@@ -945,8 +945,11 @@ remoteDispatchDomainGetSchedulerParameters(struct qemud_server *server ATTRIBUTE
 cleanup:
     if (rv < 0) {
         remoteDispatchError(rerr);
-        for (i = 0 ; i < nparams ; i++)
-            VIR_FREE(ret->params.params_val[i].field);
+        if (ret->params.params_val) {
+            for (i = 0 ; i < nparams ; i++)
+                VIR_FREE(ret->params.params_val[i].field);
+            VIR_FREE(ret->params.params_val);
+        }
     }
     if (dom)
         virDomainFree(dom);
-- 
1.7.3.1

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list


[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]