mirror of
https://gitlab.freedesktop.org/pipewire/pipewire.git
synced 2026-05-03 06:47:04 -04:00
security: fix module leak on OOM in PulseAudio do_load_module
If module_create succeeded but the subsequent calloc for pending_module failed, the module was leaked in the modules map. Move the calloc before module_create so failure cleanup is trivial. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
parent
2d8dc8b457
commit
f32295429f
1 changed files with 6 additions and 4 deletions
|
|
@ -5162,14 +5162,16 @@ static int do_load_module(struct client *client, uint32_t command, uint32_t tag,
|
||||||
pw_log_info("[%s] %s name:%s argument:%s",
|
pw_log_info("[%s] %s name:%s argument:%s",
|
||||||
client->name, commands[command].name, name, argument);
|
client->name, commands[command].name, name, argument);
|
||||||
|
|
||||||
module = module_create(impl, name, argument);
|
|
||||||
if (module == NULL)
|
|
||||||
return -errno;
|
|
||||||
|
|
||||||
pm = calloc(1, sizeof(*pm));
|
pm = calloc(1, sizeof(*pm));
|
||||||
if (pm == NULL)
|
if (pm == NULL)
|
||||||
return -errno;
|
return -errno;
|
||||||
|
|
||||||
|
module = module_create(impl, name, argument);
|
||||||
|
if (module == NULL) {
|
||||||
|
free(pm);
|
||||||
|
return -errno;
|
||||||
|
}
|
||||||
|
|
||||||
pm->tag = tag;
|
pm->tag = tag;
|
||||||
pm->client = client;
|
pm->client = client;
|
||||||
pm->module = module;
|
pm->module = module;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue