mirror of https://gitee.com/openkylin/libvirt.git
* src/virsh.c: applied patch from Masayuki Sunou to remove leaks
of domains references in some commands. Daniel
This commit is contained in:
parent
b4c282a79b
commit
6bdad268f4
|
@ -1,3 +1,8 @@
|
||||||
|
Fri Jun 29 15:46:34 CEST 2007 Daniel Veillard <veillard@redhat.com>
|
||||||
|
|
||||||
|
* src/virsh.c: applied patch from Masayuki Sunou to remove leaks
|
||||||
|
of domains references in some commands.
|
||||||
|
|
||||||
Fri Jun 29 15:18:36 CEST 2007 Daniel Veillard <veillard@redhat.com>
|
Fri Jun 29 15:18:36 CEST 2007 Daniel Veillard <veillard@redhat.com>
|
||||||
|
|
||||||
* docs/apibuild.py docs/newapi.xsl: fix generation of XML and
|
* docs/apibuild.py docs/newapi.xsl: fix generation of XML and
|
||||||
|
|
23
src/virsh.c
23
src/virsh.c
|
@ -382,6 +382,7 @@ cmdAutostart(vshControl * ctl, vshCmd * cmd)
|
||||||
else
|
else
|
||||||
vshPrint(ctl, _("Domain %s unmarked as autostarted\n"), name);
|
vshPrint(ctl, _("Domain %s unmarked as autostarted\n"), name);
|
||||||
|
|
||||||
|
virDomainFree(dom);
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -798,6 +799,7 @@ cmdCreate(vshControl * ctl, vshCmd * cmd)
|
||||||
if (dom != NULL) {
|
if (dom != NULL) {
|
||||||
vshPrint(ctl, _("Domain %s created from %s\n"),
|
vshPrint(ctl, _("Domain %s created from %s\n"),
|
||||||
virDomainGetName(dom), from);
|
virDomainGetName(dom), from);
|
||||||
|
virDomainFree(dom);
|
||||||
} else {
|
} else {
|
||||||
vshError(ctl, FALSE, _("Failed to create domain from %s"), from);
|
vshError(ctl, FALSE, _("Failed to create domain from %s"), from);
|
||||||
ret = FALSE;
|
ret = FALSE;
|
||||||
|
@ -845,6 +847,7 @@ cmdDefine(vshControl * ctl, vshCmd * cmd)
|
||||||
if (dom != NULL) {
|
if (dom != NULL) {
|
||||||
vshPrint(ctl, _("Domain %s defined from %s\n"),
|
vshPrint(ctl, _("Domain %s defined from %s\n"),
|
||||||
virDomainGetName(dom), from);
|
virDomainGetName(dom), from);
|
||||||
|
virDomainFree(dom);
|
||||||
} else {
|
} else {
|
||||||
vshError(ctl, FALSE, _("Failed to define domain from %s"), from);
|
vshError(ctl, FALSE, _("Failed to define domain from %s"), from);
|
||||||
ret = FALSE;
|
ret = FALSE;
|
||||||
|
@ -887,6 +890,7 @@ cmdUndefine(vshControl * ctl, vshCmd * cmd)
|
||||||
ret = FALSE;
|
ret = FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
virDomainFree(dom);
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -920,6 +924,7 @@ cmdStart(vshControl * ctl, vshCmd * cmd)
|
||||||
|
|
||||||
if (virDomainGetID(dom) != (unsigned int)-1) {
|
if (virDomainGetID(dom) != (unsigned int)-1) {
|
||||||
vshError(ctl, FALSE, _("Domain is already active"));
|
vshError(ctl, FALSE, _("Domain is already active"));
|
||||||
|
virDomainFree(dom);
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -931,6 +936,7 @@ cmdStart(vshControl * ctl, vshCmd * cmd)
|
||||||
virDomainGetName(dom));
|
virDomainGetName(dom));
|
||||||
ret = FALSE;
|
ret = FALSE;
|
||||||
}
|
}
|
||||||
|
virDomainFree(dom);
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1026,7 +1032,10 @@ cmdSchedinfo(vshControl * ctl, vshCmd * cmd)
|
||||||
if (capfound) nr_inputparams++;
|
if (capfound) nr_inputparams++;
|
||||||
|
|
||||||
params = vshMalloc(ctl, sizeof (virSchedParameter) * nr_inputparams);
|
params = vshMalloc(ctl, sizeof (virSchedParameter) * nr_inputparams);
|
||||||
if (params == NULL) return FALSE;
|
if (params == NULL) {
|
||||||
|
virDomainFree(dom);
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
if (weightfound) {
|
if (weightfound) {
|
||||||
strncpy(params[inputparams].field,str_weight,sizeof(str_weight));
|
strncpy(params[inputparams].field,str_weight,sizeof(str_weight));
|
||||||
|
@ -1048,7 +1057,10 @@ cmdSchedinfo(vshControl * ctl, vshCmd * cmd)
|
||||||
/* Set SchedulerParameters */
|
/* Set SchedulerParameters */
|
||||||
if (inputparams > 0) {
|
if (inputparams > 0) {
|
||||||
ret = virDomainSetSchedulerParameters(dom, params, inputparams);
|
ret = virDomainSetSchedulerParameters(dom, params, inputparams);
|
||||||
if (ret == -1) return FALSE;
|
if (ret == -1) {
|
||||||
|
virDomainFree(dom);
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
free(params);
|
free(params);
|
||||||
|
|
||||||
|
@ -1060,6 +1072,7 @@ cmdSchedinfo(vshControl * ctl, vshCmd * cmd)
|
||||||
free(schedulertype);
|
free(schedulertype);
|
||||||
} else {
|
} else {
|
||||||
vshPrint(ctl, "%-15s: %s\n", _("Scheduler"), _("Unknown"));
|
vshPrint(ctl, "%-15s: %s\n", _("Scheduler"), _("Unknown"));
|
||||||
|
virDomainFree(dom);
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1070,7 +1083,10 @@ cmdSchedinfo(vshControl * ctl, vshCmd * cmd)
|
||||||
memset (params[i].field, 0, sizeof params[i].field);
|
memset (params[i].field, 0, sizeof params[i].field);
|
||||||
}
|
}
|
||||||
ret = virDomainGetSchedulerParameters(dom, params, &nparams);
|
ret = virDomainGetSchedulerParameters(dom, params, &nparams);
|
||||||
if (ret == -1) return FALSE;
|
if (ret == -1) {
|
||||||
|
virDomainFree(dom);
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
if(nparams){
|
if(nparams){
|
||||||
for (i = 0; i < nparams; i++){
|
for (i = 0; i < nparams; i++){
|
||||||
switch (params[i].type) {
|
switch (params[i].type) {
|
||||||
|
@ -1098,6 +1114,7 @@ cmdSchedinfo(vshControl * ctl, vshCmd * cmd)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
free(params);
|
free(params);
|
||||||
|
virDomainFree(dom);
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue