[pulseaudio-discuss] [PATCH 1/3] device-port: Add mechanism to free implementation data

arun at accosted.net arun at accosted.net
Tue May 3 12:52:08 UTC 2016


From: Arun Raghavan <git at arunraghavan.net>

This will be needed if the implementation data stores pointers to
additional data that needs to be freed as well.
---
 src/pulsecore/device-port.c | 3 +++
 src/pulsecore/device-port.h | 3 +++
 2 files changed, 6 insertions(+)

diff --git a/src/pulsecore/device-port.c b/src/pulsecore/device-port.c
index 5807d3e..d0ee745 100644
--- a/src/pulsecore/device-port.c
+++ b/src/pulsecore/device-port.c
@@ -104,6 +104,9 @@ static void device_port_free(pa_object *o) {
     pa_assert(p);
     pa_assert(pa_device_port_refcnt(p) == 0);
 
+    if (p->impl_free)
+        p->impl_free(p);
+
     if (p->proplist)
         pa_proplist_free(p->proplist);
 
diff --git a/src/pulsecore/device-port.h b/src/pulsecore/device-port.h
index 85c41fa..fbdce1a 100644
--- a/src/pulsecore/device-port.h
+++ b/src/pulsecore/device-port.h
@@ -52,6 +52,9 @@ struct pa_device_port {
     pa_direction_t direction;
     int64_t latency_offset;
 
+    /* Free the extra implementation specific data. Called before other members are freed. */
+    void (*impl_free)(pa_device_port *port);
+
     /* .. followed by some implementation specific data */
 };
 
-- 
2.5.5



More information about the pulseaudio-discuss mailing list