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

Re: [libvirt] [PATCH] xenapi: Check for valid private data in xenapiSessionErrorHandle



On Sun, Mar 14, 2010 at 10:08:05PM +0100, Matthias Bolte wrote:
> ---
>  src/xenapi/xenapi_utils.c |    8 ++++----
>  1 files changed, 4 insertions(+), 4 deletions(-)
> 
> diff --git a/src/xenapi/xenapi_utils.c b/src/xenapi/xenapi_utils.c
> index 4b9a6d8..bfd53ed 100644
> --- a/src/xenapi/xenapi_utils.c
> +++ b/src/xenapi/xenapi_utils.c
> @@ -374,12 +374,12 @@ xenapiSessionErrorHandle(virConnectPtr conn, virErrorNumber errNum,
>                           const char *buf, const char *filename, const char *func,
>                           size_t lineno)
>  {
> -    xen_session *session = ((struct _xenapiPrivate *)(conn->privateData))->session;
> +    struct _xenapiPrivate *priv = conn->privateData;
>  
> -    if (buf == NULL) {
> -        char *ret = returnErrorFromSession(session);
> +    if (buf == NULL && priv != NULL && priv->session != NULL) {
> +        char *ret = returnErrorFromSession(priv->session);
>          virReportErrorHelper(conn, VIR_FROM_XENAPI, errNum, filename, func, lineno, _("%s"), ret);
> -        xen_session_clear_error(session);
> +        xen_session_clear_error(priv->session);
>          VIR_FREE(ret);
>      } else {
>          virReportErrorHelper(conn, VIR_FROM_XENAPI, errNum, filename, func, lineno, _("%s"), buf);

ACK

Daniel
-- 
|: Red Hat, Engineering, London    -o-   http://people.redhat.com/berrange/ :|
|: http://libvirt.org -o- http://virt-manager.org -o- http://deltacloud.org :|
|: http://autobuild.org        -o-         http://search.cpan.org/~danberr/ :|
|: GnuPG: 7D3B9505  -o-   F3C9 553F A1DA 4AC2 5648 23C1 B3DF F742 7D3B 9505 :|


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