Re: [libvirt] [PATCH] Domain/Net object cleanups after remote error

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

 



On Mon, May 19, 2008 at 04:58:38PM -0400, Cole Robinson wrote:
> diff --git a/src/remote_internal.c b/src/remote_internal.c
> index 51e8eb7..80f6ce6 100644
> --- a/src/remote_internal.c
> +++ b/src/remote_internal.c
> @@ -4606,6 +4606,10 @@ server_error (virConnectPtr conn, remote_error *err)
>                       err->str3 ? *err->str3 : NULL,
>                       err->int1, err->int2,
>                       "%s", err->message ? *err->message : NULL);
> +    if (dom)
> +        virDomainFree(dom);
> +    if (net)
> +        virNetworkFree(net);
>  }

Extra long hmmmmmmmmmmm ...

This is right, the domain and network are leaked.

However the virterror structure containing these pointers will be used
later.  (__virRaiseError saves it and callers access it later).

However^2 these entries in the virterror structure are deprecated.  I
added a patch last month which adds a big warning about using these
entries.  At most callers should look at the pointers themselves and
shouldn't dereference them (which would be the only safe thing to do
given that the pointers have just been freed).

But maybe there is old code around using the dom/net fields in
virterror ...  It's a bad idea even to look at those fields really.

Rich.

-- 
Richard Jones, Emerging Technologies, Red Hat  http://et.redhat.com/~rjones
virt-top is 'top' for virtual machines.  Tiny program with many
powerful monitoring features, net stats, disk stats, logging, etc.
http://et.redhat.com/~rjones/virt-top

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