Re: [PATCH] qemu: check the validity of a pointer

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

 



On Mon, Feb 16, 2015 at 21:17:17 +0100, Matthias Gatto wrote:
> In the current code if mem_mask is NULL there is a "goto error", but
> we freeing it without knowing if mem_mask is NULL or not, therefor
> I've had a check.
> 
> Signed-off-by: Matthias Gatto <matthias.gatto@xxxxxxxxxxxx>
> ---
>  src/qemu/qemu_cgroup.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/src/qemu/qemu_cgroup.c b/src/qemu/qemu_cgroup.c
> index ca255c8..926726c 100644
> --- a/src/qemu/qemu_cgroup.c
> +++ b/src/qemu/qemu_cgroup.c
> @@ -810,7 +810,8 @@ qemuRestoreCgroupState(virDomainObjPtr vm)
>          goto error;
>  
>   cleanup:
> -    VIR_FREE(mem_mask);
> +    if (mem_mask)
> +        VIR_FREE(mem_mask);

NACK,

VIR_FREE actually checks if the pointer is NULL before freeing it.

The real problem is that 'mem_mask' is not initialized to NULL.

Peter

Attachment: signature.asc
Description: Digital signature

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list

[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]