[libvirt] [PATCH 1/2] qemuDomainDetachChrDevice: Don't leak @charAlias

Peter Krempa pkrempa at redhat.com
Thu Jul 18 12:09:28 UTC 2013


s/@charAlias/@devstr/

On 07/18/13 12:44, Michal Privoznik wrote:
> Moreover, since virAsprintf now does report OOM error, there's no need
> to call virReportOOMError in error path.
> ---
>   src/qemu/qemu_hotplug.c | 6 ++----
>   1 file changed, 2 insertions(+), 4 deletions(-)
>
> diff --git a/src/qemu/qemu_hotplug.c b/src/qemu/qemu_hotplug.c
> index 788ad47..a98de9d 100644
> --- a/src/qemu/qemu_hotplug.c
> +++ b/src/qemu/qemu_hotplug.c
> @@ -3155,10 +3155,8 @@ int qemuDomainDetachChrDevice(virQEMUDriverPtr driver,
>       if (qemuBuildChrDeviceStr(&devstr, vm->def, chr, priv->qemuCaps) < 0)
>           return ret;
>
> -    if (virAsprintf(&charAlias, "char%s", tmpChr->info.alias) < 0) {
> -        virReportOOMError();
> -        return ret;
> -    }
> +    if (virAsprintf(&charAlias, "char%s", tmpChr->info.alias) < 0)
> +        goto cleanup;

This actually would leak devstr from the function called above.

>
>       qemuDomainObjEnterMonitor(driver, vm);
>       if (devstr && qemuMonitorDelDevice(priv->mon, tmpChr->info.alias) < 0) {
>

ACK when you adjust the commit message

Peter




More information about the libvir-list mailing list