2011/4/11 Eric Blake <eblake(a)redhat.com>:
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