diff --git a/libweston/weston-log-file.c b/libweston/weston-log-file.c index 0f8f4f20..25e36b46 100644 --- a/libweston/weston-log-file.c +++ b/libweston/weston-log-file.c @@ -58,6 +58,8 @@ static void weston_log_subscriber_destroy_log(struct weston_log_subscriber *subscriber) { struct weston_debug_log_file *file = to_weston_debug_log_file(subscriber); + + weston_log_subscriber_release(subscriber); free(file); } diff --git a/libweston/weston-log-flight-rec.c b/libweston/weston-log-flight-rec.c index 36323f73..7364c81a 100644 --- a/libweston/weston-log-flight-rec.c +++ b/libweston/weston-log-flight-rec.c @@ -228,6 +228,7 @@ weston_log_subscriber_destroy_flight_rec(struct weston_log_subscriber *sub) if (weston_primary_flight_recorder_ring_buffer == &flight_rec->rb) weston_primary_flight_recorder_ring_buffer = NULL; + weston_log_subscriber_release(sub); free(flight_rec->rb.buf); free(flight_rec); } diff --git a/libweston/weston-log-internal.h b/libweston/weston-log-internal.h index fbf88e56..02a05f19 100644 --- a/libweston/weston-log-internal.h +++ b/libweston/weston-log-internal.h @@ -81,6 +81,9 @@ weston_log_subscription_add(struct weston_log_scope *scope, void weston_log_subscription_remove(struct weston_log_subscription *sub); +void +weston_log_subscriber_release(struct weston_log_subscriber *subscriber); + void weston_log_bind_weston_debug(struct wl_client *client, void *data, uint32_t version, uint32_t id); diff --git a/libweston/weston-log.c b/libweston/weston-log.c index 09717c48..f5954d77 100644 --- a/libweston/weston-log.c +++ b/libweston/weston-log.c @@ -939,6 +939,21 @@ weston_log_scope_timestamp(struct weston_log_scope *scope, return buf; } +void +weston_log_subscriber_release(struct weston_log_subscriber *subscriber) +{ + struct weston_log_subscription *sub, *sub_tmp; + + wl_list_for_each_safe(sub, sub_tmp, &subscriber->subscription_list, owner_link) { + /* destroy each subscription */ + if (sub->owner->destroy_subscription) + sub->owner->destroy_subscription(sub->owner); + + weston_log_subscription_destroy(sub); + } + +} + /** Destroy a file type or a flight-rec type subscriber. * * They are created, respectively, with weston_log_subscriber_create_log()