[libvirt] [PATCH v3 02/10] Convert public datatypes to inherit from virObject
Daniel P. Berrange
berrange at redhat.com
Mon Aug 6 18:50:06 UTC 2012
On Mon, Aug 06, 2012 at 10:57:41AM -0600, Eric Blake wrote:
> On 08/06/2012 05:52 AM, Daniel P. Berrange wrote:
> > From: "Daniel P. Berrange" <berrange at redhat.com>
> >
> > This converts the following public API datatypes to use the
> > virObject infrastructure:
> >
>
> > /**
> > - * virReleaseConnect:
> > + * virConnectDispose:
> > * @conn: the hypervisor connection to release
> > *
> > * Unconditionally release all memory associated with a connection.
> > @@ -90,13 +124,9 @@ failed:
> > * be used once this method returns.
> > */
> > static void
> > -virReleaseConnect(virConnectPtr conn) {
> > - VIR_DEBUG("release connection %p", conn);
> > -
> > - /* make sure to release the connection lock before we call the
> > - * close callbacks, otherwise we will deadlock if an error
> > - * is raised by any of the callbacks */
> > - virMutexUnlock(&conn->lock);
> > +virConnectDispose(void *obj)
> > +{
> > + virConnectPtr conn = obj;
> >
> > if (conn->networkDriver)
> > conn->networkDriver->close(conn);
> > @@ -127,35 +157,6 @@ virReleaseConnect(virConnectPtr conn) {
> > VIR_FREE(conn);
>
> Ouch. I missed this bug, which causes 'make check' to segfault due to a
> double-free of each virConnectPtr. Squash this in.
>
> diff --git i/src/datatypes.c w/src/datatypes.c
> index e827c2d..d65eec0 100644
> --- i/src/datatypes.c
> +++ w/src/datatypes.c
> @@ -154,7 +154,6 @@ virConnectDispose(void *obj)
>
> virMutexUnlock(&conn->lock);
> virMutexDestroy(&conn->lock);
> - VIR_FREE(conn);
> }
Opps, this was a rebase mistake - I had giant conflicts in this file
to sort out
Daniel
--
|: http://berrange.com -o- http://www.flickr.com/photos/dberrange/ :|
|: http://libvirt.org -o- http://virt-manager.org :|
|: http://autobuild.org -o- http://search.cpan.org/~danberr/ :|
|: http://entangle-photo.org -o- http://live.gnome.org/gtk-vnc :|
More information about the libvir-list
mailing list