The 'handle' field is not guaranteed to be initialized, hence a check is required before closing it. Signed-off-by: Yordan Karadzhov (VMware) <y.karadz@xxxxxxxxx> --- src/libkshark-plugin.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/libkshark-plugin.c b/src/libkshark-plugin.c index 09886ce..2eb3b4a 100644 --- a/src/libkshark-plugin.c +++ b/src/libkshark-plugin.c @@ -219,9 +219,10 @@ void kshark_free_draw_handler_list(struct kshark_draw_handler *handlers) /** Close and free this plugin. */ static void free_plugin(struct kshark_plugin_list *plugin) { - dlclose(plugin->handle); + if (plugin->handle) + dlclose(plugin->handle); - if (plugin->process_interface){ + if (plugin->process_interface) { free(plugin->process_interface->name); free(plugin->process_interface); } -- 2.32.0