mirror of
https://gitlab.freedesktop.org/pipewire/pipewire.git
synced 2025-11-05 13:30:02 -05:00
modules: avoid invalid properties access
pw_spa_node_load() takes ownership of the properties so we must not access it it afterwards, so make a copy of it.
This commit is contained in:
parent
513e8fa56f
commit
490d540177
1 changed files with 8 additions and 3 deletions
|
|
@ -12,6 +12,7 @@
|
||||||
#include "config.h"
|
#include "config.h"
|
||||||
|
|
||||||
#include "pipewire/impl.h"
|
#include "pipewire/impl.h"
|
||||||
|
#include "pipewire/cleanup.h"
|
||||||
|
|
||||||
#include "spa-node.h"
|
#include "spa-node.h"
|
||||||
|
|
||||||
|
|
@ -196,6 +197,7 @@ static void *create_object(void *_data,
|
||||||
int res;
|
int res;
|
||||||
struct pw_impl_client *client;
|
struct pw_impl_client *client;
|
||||||
bool linger;
|
bool linger;
|
||||||
|
spa_autoptr(pw_properties) copy = NULL;
|
||||||
|
|
||||||
if (properties == NULL)
|
if (properties == NULL)
|
||||||
goto error_properties;
|
goto error_properties;
|
||||||
|
|
@ -214,10 +216,13 @@ static void *create_object(void *_data,
|
||||||
pw_properties_setf(properties, PW_KEY_CLIENT_ID, "%d",
|
pw_properties_setf(properties, PW_KEY_CLIENT_ID, "%d",
|
||||||
pw_global_get_id(pw_impl_client_get_global(client)));
|
pw_global_get_id(pw_impl_client_get_global(client)));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
copy = pw_properties_copy(properties);
|
||||||
|
|
||||||
node = pw_spa_node_load(context,
|
node = pw_spa_node_load(context,
|
||||||
factory_name,
|
factory_name,
|
||||||
PW_SPA_NODE_FLAG_ACTIVATE,
|
PW_SPA_NODE_FLAG_ACTIVATE,
|
||||||
properties,
|
spa_steal_ptr(properties),
|
||||||
sizeof(struct node_data));
|
sizeof(struct node_data));
|
||||||
if (node == NULL)
|
if (node == NULL)
|
||||||
goto error_create_node;
|
goto error_create_node;
|
||||||
|
|
@ -241,8 +246,8 @@ static void *create_object(void *_data,
|
||||||
|
|
||||||
pw_resource_add_listener(nd->resource, &nd->resource_listener, &resource_events, nd);
|
pw_resource_add_listener(nd->resource, &nd->resource_listener, &resource_events, nd);
|
||||||
}
|
}
|
||||||
if (pw_properties_get_bool(properties, PW_KEY_OBJECT_EXPORT, false)) {
|
if (pw_properties_get_bool(copy, PW_KEY_OBJECT_EXPORT, false)) {
|
||||||
res = export_node(nd, properties);
|
res = export_node(nd, copy);
|
||||||
if (res < 0)
|
if (res < 0)
|
||||||
goto error_export;
|
goto error_export;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue