summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorArun Raghavan <git@arunraghavan.net>2016-05-03 18:22:08 +0530
committerArun Raghavan <arun@arunraghavan.net>2016-06-22 21:04:47 +0530
commit9e10c1caa34524c52538283083b134ccf0046998 (patch)
tree66380706d07637767ce17e307518f4a5a1325657
parent694662d9363d1f61a1021e45fab80ca1e81f3ab1 (diff)
device-port: Add mechanism to free implementation data
This will be needed if the implementation data stores pointers to additional data that needs to be freed as well.
-rw-r--r--src/pulsecore/device-port.c3
-rw-r--r--src/pulsecore/device-port.h3
2 files changed, 6 insertions, 0 deletions
diff --git a/src/pulsecore/device-port.c b/src/pulsecore/device-port.c
index ab3b2e85c..7c9ddf325 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 85c41fa83..fbdce1aa0 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 */
};