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

Jim Fehlig jfehlig at suse.com
Fri May 17 20:18:11 UTC 2013


On 05/16/2013 01:56 PM, Eric Blake wrote:
> 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.

Thanks Eric.  I made your suggested changes and pushed the patches.

Regards,
Jim




More information about the libvir-list mailing list