From: Eric Blake <eblake(a)redhat.com>
https://www.redhat.com/archives/libvir-list/2011-December/msg00854.html
---
daemon/remote.c | 22 ++++++++++------------
1 files changed, 10 insertions(+), 12 deletions(-)
diff --git a/daemon/remote.c b/daemon/remote.c
index e1d208c..cb4e369 100644
--- a/daemon/remote.c
+++ b/daemon/remote.c
@@ -759,7 +759,7 @@ cleanup:
if (val) {
for (i = 0; i < nparams; i++) {
VIR_FREE(val[i].field);
- if (params[i].type == VIR_TYPED_PARAM_STRING)
+ if (val[i].value.type == VIR_TYPED_PARAM_STRING)
VIR_FREE(val[i].value.remote_typed_param_value_u.s);
}
VIR_FREE(val);
@@ -898,9 +898,10 @@ remoteDispatchDomainGetSchedulerParameters(virNetServerPtr server
ATTRIBUTE_UNUS
cleanup:
if (rv < 0)
virNetMessageSaveError(rerr);
+ virTypedParameterArrayClear(params, nparams);
+ VIR_FREE(params);
if (dom)
virDomainFree(dom);
- VIR_FREE(params);
return rv;
no_memory:
@@ -953,9 +954,10 @@ remoteDispatchDomainGetSchedulerParametersFlags(virNetServerPtr
server ATTRIBUTE
cleanup:
if (rv < 0)
virNetMessageSaveError(rerr);
+ virTypedParameterArrayClear(params, nparams);
+ VIR_FREE(params);
if (dom)
virDomainFree(dom);
- VIR_FREE(params);
return rv;
no_memory:
@@ -1140,17 +1142,12 @@ success:
rv = 0;
cleanup:
- if (rv < 0) {
+ if (rv < 0)
virNetMessageSaveError(rerr);
- 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);
- }
- }
+ virTypedParameterArrayClear(params, nparams);
+ VIR_FREE(params);
if (dom)
virDomainFree(dom);
- VIR_FREE(params);
return rv;
}
@@ -1623,9 +1620,10 @@ success:
cleanup:
if (rv < 0)
virNetMessageSaveError(rerr);
+ virTypedParameterArrayClear(params, nparams);
+ VIR_FREE(params);
if (dom)
virDomainFree(dom);
- VIR_FREE(params);
return rv;
}
--
1.7.4.4