plugin: Always dlclose() a module with a handle

Even if it doesn't have a ca_exit function.  Otherwise it will leave
modules lying around.

Signed-off-by: Corey Minyard <minyard@acm.org>
This commit is contained in:
Corey Minyard 2024-05-29 18:28:58 -05:00 committed by Olof Hagsand
parent 54ba56a41e
commit c94ca6179f

View file

@ -582,11 +582,11 @@ clixon_plugin_exit_one(clixon_plugin_t *cp,
}
if (clixon_resource_check(h, &wh, cp->cp_name, __FUNCTION__) < 0)
goto done;
if (dlclose(cp->cp_handle) != 0) {
}
if (cp->cp_handle && dlclose(cp->cp_handle) != 0) {
error = (char*)dlerror();
clixon_err(OE_PLUGIN, errno, "dlclose: %s", error ? error : "Unknown error");
}
}
retval = 0;
done:
return retval;