Daniel P. Berrange wrote:
On Tue, Apr 28, 2009 at 12:25:41PM -0400, Cole Robinson wrote:
> diff --git a/src/qemu_driver.c b/src/qemu_driver.c
> index 79ee072..6b5c17f 100644
> --- a/src/qemu_driver.c
> +++ b/src/qemu_driver.c
> @@ -1872,10 +1872,12 @@ static int qemudGetNodeInfo(virConnectPtr conn,
>
> static char *qemudGetCapabilities(virConnectPtr conn) {
> struct qemud_driver *driver = conn->privateData;
> - char *xml;
> + char *xml = NULL;
>
> qemuDriverLock(driver);
> - if ((xml = virCapabilitiesFormatXML(driver->caps)) == NULL)
> + virCapabilitiesFree(qemu_driver->caps);
> + if ((qemu_driver->caps = qemudCapsInit()) == NULL ||
> + (xml = virCapabilitiesFormatXML(driver->caps)) == NULL)
> virReportOOMError(conn);
> qemuDriverUnlock(driver);
The thing to be wary of now, is that all use of driver->caps needs
to be protected by the driver mutex. Most usages are OK, but I
spotted a couple that are not.
Daniel
Okay, updated patch attached. The only unsafe caps usage I found was in
qemudNodeGetSecurityModel, not sure if you spotted any others.
Thanks,
Cole