diff --git a/libsemanage/src/modules.c b/libsemanage/src/modules.c index 131f5024..90c5e491 100644 --- a/libsemanage/src/modules.c +++ b/libsemanage/src/modules.c @@ -690,10 +690,12 @@ int semanage_module_key_destroy(semanage_handle_t *sh, { assert(sh); - if (modkey) { - free(modkey->name); + if (!modkey) { + return 0; } + free(modkey->name); + return semanage_module_key_init(sh, modkey); }