Call dlclose() only when having a valid handle.

Signed-off-by: Nikos Mavrogiannopoulos <nmav@redhat.com>
This commit is contained in:
Nikos Mavrogiannopoulos 2014-02-28 16:17:37 +01:00 committed by Viktor Tarasov
parent fc5714a4c9
commit 218d198bdc

View File

@ -74,7 +74,7 @@ C_UnloadModule(void *module)
if (!mod || mod->_magic != MAGIC)
return CKR_ARGUMENTS_BAD;
if (sc_dlclose(mod->handle) < 0)
if (mod->handle != NULL && sc_dlclose(mod->handle) < 0)
return CKR_FUNCTION_FAILED;
memset(mod, 0, sizeof(*mod));