]> xenbits.xensource.com Git - libvirt.git/commitdiff
free memory properly in cleanup patch
authorHu Tao <hutao@cn.fujitsu.com>
Tue, 26 Apr 2011 01:20:31 +0000 (09:20 +0800)
committerWen Congyang <wency@cn.fujitsu.com>
Wed, 27 Apr 2011 12:12:14 +0000 (20:12 +0800)
virsh schedinfo inactive-domain will trigger the problem.

daemon/remote.c

index 1c98bba0316677856f6c18357de04e7eab8d2136..eedbc770fc1451b55acea56bd49b3996d61f9af4 100644 (file)
@@ -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);