mirror of
https://gitlab.freedesktop.org/pipewire/pipewire.git
synced 2025-11-02 09:01:50 -05:00
filter-chain: fix reference counting issue
Fix a reference counting issue that resulted in ladspa_handle's refcount being equal to the sum of the refcounts of its descriptors. This would result in a memory leak when a descriptor is loaded more than once from the same handle. This cannot happen because `ladspa_handle_list` is not populated by `ladspa_handle_load()`. The next commit implements exactly that, so the fix is applied before the change that would introduce the problem.
This commit is contained in:
parent
e9ba0899c2
commit
a8a6def20f
1 changed files with 9 additions and 0 deletions
|
|
@ -844,6 +844,15 @@ static struct ladspa_descriptor *ladspa_descriptor_load(struct impl *impl,
|
|||
spa_list_for_each(desc, &hndl->descriptor_list, link) {
|
||||
if (spa_streq(desc->label, label)) {
|
||||
desc->ref++;
|
||||
|
||||
/*
|
||||
* since ladspa_handle_load() increments the reference count of the handle,
|
||||
* if the descriptor is found, then the handle's reference count
|
||||
* has already been incremented to account for the descriptor,
|
||||
* so we need to unref handle here since we're merely reusing
|
||||
* thedescriptor, not creating a new one
|
||||
*/
|
||||
ladspa_handle_unref(hndl);
|
||||
return desc;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue