summaryrefslogtreecommitdiff
path: root/p11-kit/modules.c
diff options
context:
space:
mode:
Diffstat (limited to 'p11-kit/modules.c')
-rw-r--r--p11-kit/modules.c18
1 files changed, 10 insertions, 8 deletions
diff --git a/p11-kit/modules.c b/p11-kit/modules.c
index 0299eda..891ce4c 100644
--- a/p11-kit/modules.c
+++ b/p11-kit/modules.c
@@ -797,14 +797,16 @@ init_globals_unlocked (void)
static void
free_modules_when_no_refs_unlocked (void)
{
- Module *mod;
- p11_dictiter iter;
-
- /* Check if any modules have a ref count */
- p11_dict_iterate (gl.modules, &iter);
- while (p11_dict_next (&iter, (void **)&mod, NULL)) {
- if (mod->ref_count)
- return;
+ if (gl.modules) {
+ Module *mod;
+ p11_dictiter iter;
+
+ /* Check if any modules have a ref count */
+ p11_dict_iterate (gl.modules, &iter);
+ while (p11_dict_next (&iter, (void **)&mod, NULL)) {
+ if (mod->ref_count)
+ return;
+ }
}
p11_dict_free (gl.unmanaged_by_funcs);