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

Re: [libvirt] [PATCH 2/2] libxl: fix leaking libxl events



On 05/16/2013 10:01 AM, Jim Fehlig wrote:
> libxl expects the event handler to free the event passed to it.  From
> libxl_event.h:
> 
>    event becomes owned by the application and must be freed, either
>    by event_occurs or later
> ---
>  src/libxl/libxl_driver.c |    8 +++++++-
>  1 files changed, 7 insertions(+), 1 deletions(-)
> 

> @@ -764,6 +765,11 @@ cleanup:
>          libxlDomainEventQueue(driver, dom_event);
>          libxlDriverUnlock(driver);
>      }
> +#ifdef LIBXL_HAVE_NONCONST_EVENT_OCCURS_EVENT_ARG
> +    libxl_event_free(priv->ctx, event);
> +#else
> +    libxl_event_free(priv->ctx, (libxl_event *)event);
> +#endif

At least here your #ifdef isn't inside (), but it is inside a function
body.  Have I mentioned that I like my #ifdefs hoisted to the top level,
when possible? :)

Here, you could avoid the #ifdef, and just write:

/* cast away any const */
libxl_event_free(priv->ctx, (libxl_event *)event);

At any rate, ACK to your series, whether or not you clean up the #ifdefs.

-- 
Eric Blake   eblake redhat com    +1-919-301-3266
Libvirt virtualization library http://libvirt.org

Attachment: signature.asc
Description: OpenPGP digital signature


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