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

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

 



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

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list




[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]