[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

Re: [libvirt] [PATCH 1/4] libvirtd: avoid memory leak on OOM



At 07/01/2011 07:36 AM, Eric Blake Write:
> Detected by Coverity; only strikes on OOM so not serious.
> 
> * daemon/libvirtd.c (daemonPidFilePath): Plug leak.
> ---
>  daemon/libvirtd.c |    4 +++-
>  1 files changed, 3 insertions(+), 1 deletions(-)
> 
> diff --git a/daemon/libvirtd.c b/daemon/libvirtd.c
> index 60ee705..06d2077 100644
> --- a/daemon/libvirtd.c
> +++ b/daemon/libvirtd.c
> @@ -310,8 +310,10 @@ daemonPidFilePath(bool privileged,
>          if (!(userdir = virGetUserDirectory(geteuid())))
>              goto error;
> 
> -        if (virAsprintf(pidfile, "%s/.libvirt/libvirtd.pid", userdir) < 0)
> +        if (virAsprintf(pidfile, "%s/.libvirt/libvirtd.pid", userdir) < 0) {
> +            VIR_FREE(userdir);
>              goto no_memory;
> +        }
> 
>          VIR_FREE(userdir);
>      }


ACK


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]