device-port: Add mechanism to free implementation data
authorArun Raghavan <git@arunraghavan.net>
Tue, 3 May 2016 12:52:08 +0000 (18:22 +0530)
committerArun Raghavan <arun@arunraghavan.net>
Wed, 22 Jun 2016 15:34:47 +0000 (21:04 +0530)
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
src/pulsecore/device-port.h

index ab3b2e8..7c9ddf3 100644 (file)
@@ -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);
 
index 85c41fa..fbdce1a 100644 (file)
@@ -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 */
 };