2011/4/11 Eric Blake <eblake@xxxxxxxxxx>: > On 04/10/2011 09:18 AM, Matthias Bolte wrote: >> This will be used to make esxVI_Context clonable. >> >> Also move cleanup code for esxPrivate to esxFreePrivate(). >> --- >> Âsrc/esx/esx_driver.c Â| Â103 ++++++++++++++++++++++++------------------------- >> Âsrc/esx/esx_private.h | Â Â4 +- >> Â2 files changed, 52 insertions(+), 55 deletions(-) > > ACK; looks like a relatively straightforward refactor, followed by lots > of renaming fallout. Thanks, pushed. Matthias >> @@ -1070,14 +1072,9 @@ esxClose(virConnectPtr conn) >> Â Â Â Â Â Â ÂesxVI_Logout(priv->vCenter) < 0) { >> Â Â Â Â Â Â Âresult = -1; >> Â Â Â Â Â} >> - >> - Â Â Â ÂesxVI_Context_Free(&priv->vCenter); >> Â Â Â} >> >> - Â ÂvirCapabilitiesFree(priv->caps); >> - >> - Â ÂVIR_FREE(priv->transport); >> - Â ÂVIR_FREE(priv); >> + Â ÂesxFreePrivate(&priv); >> >> Â Â Âconn->privateData = NULL; > > Is this line now redundant, since priv was initialized as > conn->privateData, and esxFreePrivate(&priv) guarantees that priv will > be reassigned to NULL? Freeing priv frees the private data struct instance and sets priv to NULL, but priv doesn't reference conn->privateData, it only points to the same memory as it. Therefore, conn->privateData is a stale pointer now and hast to be set to NULL manually. Matthias -- libvir-list mailing list libvir-list@xxxxxxxxxx https://www.redhat.com/mailman/listinfo/libvir-list