mirror of
https://gitlab.freedesktop.org/pipewire/pipewire
synced 2024-10-06 16:09:43 +00:00
test: fix dll unload
Call spa_handle_clear() on the handle before freeing. Actually store the loaded dll in the right array. First clear the handle, then close the dll. Fix iteration of the dlls.
This commit is contained in:
parent
c346ee5e90
commit
d28af43689
|
@ -305,12 +305,14 @@ pwtest_spa_plugin_destroy(struct pwtest_spa_plugin *plugin)
|
|||
struct spa_handle **hnd;
|
||||
|
||||
SPA_FOR_EACH_ELEMENT(plugin->handles, hnd) {
|
||||
if (*hnd)
|
||||
if (*hnd) {
|
||||
spa_handle_clear(*hnd);
|
||||
free(*hnd);
|
||||
}
|
||||
}
|
||||
SPA_FOR_EACH_ELEMENT(plugin->dlls, dll) {
|
||||
if (*dll)
|
||||
dlclose(dll);
|
||||
dlclose(*dll);
|
||||
}
|
||||
free(plugin);
|
||||
}
|
||||
|
@ -362,12 +364,13 @@ pwtest_spa_plugin_try_load_interface(struct pwtest_spa_plugin *plugin,
|
|||
r = spa_handle_factory_init(factory, handle, info, plugin->support, plugin->nsupport);
|
||||
pwtest_neg_errno_ok(r);
|
||||
if ((r = spa_handle_get_interface(handle, interface_name, &iface)) != 0) {
|
||||
dlclose(hnd);
|
||||
spa_handle_clear(handle);
|
||||
free(handle);
|
||||
dlclose(hnd);
|
||||
return -ENOSYS;
|
||||
}
|
||||
|
||||
plugin->handles[plugin->ndlls++] = hnd;
|
||||
plugin->dlls[plugin->ndlls++] = hnd;
|
||||
plugin->handles[plugin->nhandles++] = handle;
|
||||
plugin->support[plugin->nsupport++] = SPA_SUPPORT_INIT(interface_name, iface);
|
||||
|
||||
|
|
Loading…
Reference in a new issue