kernel-shark: Fix potential segfault in free_plugin()
PATCH 1/1 kernel-shark: Fix potential segfault in free_plugin()
The 'handle' field is not guaranteed to be initialized, hence a check is required before closing it.
Signed-off-by Yordan Karadzhov (VMware) <[email protected]>
--- src/libkshark-plugin.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)
src/libkshark-plugin.c +3 -2
@@ -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); }
Signature · 1 line
2.32.0