mirror of
https://gitlab.freedesktop.org/pipewire/pipewire.git
synced 2026-01-10 11:08:44 -05:00
Use refcounting for async shutdown
fix some memory leaks
This commit is contained in:
parent
ee0aa6a2ac
commit
6d4db64767
21 changed files with 216 additions and 260 deletions
|
|
@ -42,8 +42,16 @@ check_global_owner (PinosCore *core,
|
|||
PinosGlobal *global;
|
||||
|
||||
global = pinos_map_lookup (&core->objects, id);
|
||||
if (global == NULL)
|
||||
return false;
|
||||
|
||||
return (global && global->owner == client);
|
||||
if (global->owner == NULL)
|
||||
return true;
|
||||
|
||||
if (global->owner->ucred.uid == client->ucred.uid)
|
||||
return true;
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
static void
|
||||
|
|
|
|||
|
|
@ -82,7 +82,8 @@ try_link_port (PinosNode *node, PinosPort *port, ModuleImpl *impl)
|
|||
|
||||
error:
|
||||
{
|
||||
pinos_node_update_state (node, PINOS_NODE_STATE_ERROR, error);
|
||||
pinos_log_error ("module %p: can't link node '%s'", impl, error);
|
||||
free (error);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
|
@ -271,6 +272,6 @@ module_destroy (ModuleImpl *impl)
|
|||
bool
|
||||
pinos__module_init (PinosModule * module, const char * args)
|
||||
{
|
||||
module_new (module->core, NULL);
|
||||
module->user_data = module_new (module->core, NULL);
|
||||
return true;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -251,7 +251,7 @@ client_new (PinosProtocolDBus *impl,
|
|||
PinosProtocolDBusClient *this;
|
||||
PinosClient *client;
|
||||
|
||||
client = pinos_client_new (impl->core, NULL);
|
||||
client = pinos_client_new (impl->core, NULL, NULL);
|
||||
|
||||
if ((this = (PinosProtocolDBusClient *) find_object (impl, client))) {
|
||||
pinos_client1_set_sender (this->parent.iface, sender);
|
||||
|
|
|
|||
|
|
@ -180,6 +180,7 @@ client_new (PinosProtocolNative *impl,
|
|||
PinosProtocolNativeClient *this;
|
||||
PinosClient *client;
|
||||
socklen_t len;
|
||||
struct ucred ucred, *ucredp;
|
||||
|
||||
this = calloc (1, sizeof (PinosProtocolNativeClient));
|
||||
if (this == NULL)
|
||||
|
|
@ -200,7 +201,15 @@ client_new (PinosProtocolNative *impl,
|
|||
if (this->connection == NULL)
|
||||
goto no_connection;
|
||||
|
||||
client = pinos_client_new (impl->core, NULL);
|
||||
len = sizeof (ucred);
|
||||
if (getsockopt (fd, SOL_SOCKET, SO_PEERCRED, &ucred, &len) < 0) {
|
||||
pinos_log_error ("no peercred: %m");
|
||||
ucredp = NULL;
|
||||
} else {
|
||||
ucredp = &ucred;
|
||||
}
|
||||
|
||||
client = pinos_client_new (impl->core, ucredp, NULL);
|
||||
if (client == NULL)
|
||||
goto no_client;
|
||||
|
||||
|
|
@ -210,14 +219,6 @@ client_new (PinosProtocolNative *impl,
|
|||
client_send_func,
|
||||
this);
|
||||
|
||||
len = sizeof (client->ucred);
|
||||
if (getsockopt (fd, SOL_SOCKET, SO_PEERCRED, &client->ucred, &len) < 0) {
|
||||
client->ucred_valid = false;
|
||||
pinos_log_error ("no peercred: %m");
|
||||
} else {
|
||||
client->ucred_valid = true;
|
||||
}
|
||||
|
||||
spa_list_insert (impl->client_list.prev, &this->link);
|
||||
|
||||
pinos_global_bind (impl->core->global,
|
||||
|
|
|
|||
|
|
@ -113,6 +113,7 @@ pinos__module_init (PinosModule * module, const char * args)
|
|||
}
|
||||
}
|
||||
free (argv);
|
||||
pinos_free_strv (tmp_argv);
|
||||
}
|
||||
|
||||
pinos_spa_monitor_load (module->core, "build/spa/plugins/alsa/libspa-alsa.so", "alsa-monitor");
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue