Avoid virsh leaks due to missing virDomainFree(dom) calls

* src/virsh.c (cmdDomuuid): Add missing virDomainFree call.
(cmdAttachDevice): Likewise.
(cmdDetachDevice): Likewise.
This commit is contained in:
Jim Meyering 2008-01-30 19:58:59 +00:00
parent a1d2d2b21c
commit f5f530f33f
2 changed files with 12 additions and 2 deletions

View File

@ -1,5 +1,10 @@
Wed Jan 30 20:49:34 CET 2008 Jim Meyering <meyering@redhat.com>
Avoid virsh leaks due to missing virDomainFree(dom) calls
* src/virsh.c (cmdDomuuid): Add missing virDomainFree call.
(cmdAttachDevice): Likewise.
(cmdDetachDevice): Likewise.
* src/virsh.c (cmdCapabilities): Plug a small leak.
* src/test.c (testLoadDomain): Avoid leaks upon failure.

View File

@ -2161,6 +2161,7 @@ cmdDomuuid(vshControl * ctl, vshCmd * cmd)
else
vshError(ctl, FALSE, "%s", _("failed to get domain UUID"));
virDomainFree(dom);
return TRUE;
}
@ -3038,8 +3039,10 @@ cmdAttachDevice(vshControl * ctl, vshCmd * cmd)
return FALSE;
}
if (virFileReadAll(from, VIRSH_MAX_XML_FILE, &buffer) < 0)
if (virFileReadAll(from, VIRSH_MAX_XML_FILE, &buffer) < 0) {
virDomainFree(dom);
return FALSE;
}
ret = virDomainAttachDevice(dom, buffer);
free (buffer);
@ -3092,8 +3095,10 @@ cmdDetachDevice(vshControl * ctl, vshCmd * cmd)
return FALSE;
}
if (virFileReadAll(from, VIRSH_MAX_XML_FILE, &buffer) < 0)
if (virFileReadAll(from, VIRSH_MAX_XML_FILE, &buffer) < 0) {
virDomainFree(dom);
return FALSE;
}
ret = virDomainDetachDevice(dom, buffer);
free (buffer);