LADI
/
spa
1
Fork 0

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:
Wim Taymans 2022-02-08 11:31:38 +01:00
parent c346ee5e90
commit d28af43689
1 changed files with 7 additions and 4 deletions

View File

@ -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);