Re: [libvirt PATCH 1/2] lxc: replace VIR_FREE with g_autofree / g_free

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

 



First time in a while - Coverity complained this morning

[...]

> diff --git a/src/lxc/lxc_fuse.c b/src/lxc/lxc_fuse.c
> index e73b4d0690..c4223f4e06 100644
> --- a/src/lxc/lxc_fuse.c
> +++ b/src/lxc/lxc_fuse.c
> @@ -326,10 +326,10 @@ int lxcSetupFuse(virLXCFusePtr *f, virDomainDefPtr def)
>      *f = fuse;

^^
Event use_after_free:	Using freed pointer "fuse".
Also see events:	[alias][freed_arg]

>      return ret;
>   cleanup1:
> -    VIR_FREE(fuse->mountpoint);
> +    g_free(fuse->mountpoint);
>      virMutexDestroy(&fuse->lock);
>   cleanup2:
> -    VIR_FREE(fuse);
> +    g_free(fuse);

^^
Event freed_arg:	"g_free" frees "fuse".

A fuse = NULL; here will make coverity happy, but not sure if that's
standard any more... The VIR_FREE would have done thta for us IIRC.

John

[...]




[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]

  Powered by Linux