mirror of
https://gitlab.freedesktop.org/pipewire/pipewire.git
synced 2025-11-04 13:30:12 -05:00
add pw_deinit() to cleanup resources
Add and use pw_deinit() to avoid leaking the support plugins and use this in the main daemon. Makes valgrind output better.
This commit is contained in:
parent
09913ca4ab
commit
00d61d958e
3 changed files with 27 additions and 0 deletions
|
|
@ -132,6 +132,7 @@ int main(int argc, char *argv[])
|
||||||
pw_daemon_config_free(config);
|
pw_daemon_config_free(config);
|
||||||
pw_context_destroy(context);
|
pw_context_destroy(context);
|
||||||
pw_main_loop_destroy(loop);
|
pw_main_loop_destroy(loop);
|
||||||
|
pw_deinit();
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -409,6 +409,30 @@ void pw_init(int *argc, char **argv[])
|
||||||
pw_log_info("version %s", pw_get_library_version());
|
pw_log_info("version %s", pw_get_library_version());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
SPA_EXPORT
|
||||||
|
void pw_deinit(void)
|
||||||
|
{
|
||||||
|
struct support *support = &global_support;
|
||||||
|
struct registry *registry = &global_registry;
|
||||||
|
struct plugin *p;
|
||||||
|
|
||||||
|
support->plugin_dir = NULL;
|
||||||
|
if (support->categories)
|
||||||
|
pw_free_strv(support->categories);
|
||||||
|
support->categories = NULL;
|
||||||
|
support->support_lib = NULL;
|
||||||
|
|
||||||
|
pw_log_set(NULL);
|
||||||
|
|
||||||
|
spa_list_consume(p, ®istry->plugins, link) {
|
||||||
|
struct handle *h;
|
||||||
|
p->ref++;
|
||||||
|
spa_list_consume(h, &p->handles, link)
|
||||||
|
unref_handle(h);
|
||||||
|
unref_plugin(p);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/** Check if a debug category is enabled
|
/** Check if a debug category is enabled
|
||||||
*
|
*
|
||||||
* \param name the name of the category to check
|
* \param name the name of the category to check
|
||||||
|
|
|
||||||
|
|
@ -116,6 +116,8 @@ extern "C" {
|
||||||
void
|
void
|
||||||
pw_init(int *argc, char **argv[]);
|
pw_init(int *argc, char **argv[]);
|
||||||
|
|
||||||
|
void pw_deinit(void);
|
||||||
|
|
||||||
bool
|
bool
|
||||||
pw_debug_is_category_enabled(const char *name);
|
pw_debug_is_category_enabled(const char *name);
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue