hal_tdm_backend *tdm_backend = NULL;
hal_tdm_display *hal_tdm_dpy = NULL;
tdm_private_module *private_module = NULL;
+ tdm_backend_module *module_data = NULL;
hal_tdm_event_source **event_sources = NULL;
hal_tdm_caps_display caps;
hal_tdm_caps_pp pp_caps;
return TDM_ERROR_OUT_OF_MEMORY;
}
+ module_data = calloc(1, sizeof *module_data);
+ if (module_data == NULL) {
+ TDM_ERR("failed: alloc");
+ goto fail;
+ }
+ module_data->name = hal_tdm_backend_get_name(tdm_backend);
+ module_data->vendor = hal_tdm_backend_get_vendor(tdm_backend);
+ module_data->abi_version = hal_tdm_backend_get_abi_version(tdm_backend);
+
hal_tdm_dpy = hal_tdm_backend_get_display(tdm_backend, &hret);
if (hal_tdm_dpy == NULL || hret != HAL_TDM_ERROR_NONE) {
TDM_ERR("failed hal_tdm_backend_get_display");
private_module->use_hal_tdm = 1;
private_module->htdm_backend = tdm_backend;
+ private_module->module_data = module_data;
private_module->htdm_dpy = hal_tdm_dpy;
private_module->private_display = private_display;
private_display->current_module = private_module;
if (master_drm_fd >= 0)
close(master_drm_fd);
hal_tdm_put_backend(tdm_backend);
+ free(module_data);
free(private_module);
+
return TDM_ERROR_NO_MODULE;
}
_tdm_display_unload_modules(tdm_private_display *private_display)
{
tdm_private_module *private_module = NULL, *bb = NULL;
+ tdm_backend_module *module_data = NULL;
LIST_FOR_EACH_ENTRY_SAFE(private_module, bb, &private_display->module_list, link) {
LIST_DEL(&private_module->link);
tdm_event_loop_source_remove(htdm_event_source);
}
}
+
+ module_data = private_module->module_data;
+ if (module_data){
+ free(module_data->name);
+ free(module_data->vendor);
+ free(module_data);
+ }
hal_tdm_put_backend(private_module->htdm_backend);
free(private_module);
- continue;
- }
-
- if (private_module->module_data)
- private_module->module_data->deinit(private_module->bdata);
- if (private_module->module)
- dlclose(private_module->module);
+ } else {
+ if (private_module->module_data)
+ private_module->module_data->deinit(private_module->bdata);
+ if (private_module->module)
+ dlclose(private_module->module);
- free(private_module);
+ free(private_module);
+ }
}
}
/* LCOV_EXCL_STOP */