From 45c4c5c6af9816df36118a51341e3d0a618c0a6e Mon Sep 17 00:00:00 2001 From: Boram Park Date: Mon, 26 Feb 2018 15:36:14 +0900 Subject: [PATCH] server: check return value Change-Id: I6efd4944ec752d7b9ce70ed67a2ef73021b1f1f1 --- src/tdm_server.c | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/src/tdm_server.c b/src/tdm_server.c index 840e575..f5e222a 100644 --- a/src/tdm_server.c +++ b/src/tdm_server.c @@ -634,14 +634,21 @@ _tdm_server_cb_create_output(struct wl_client *client, struct wl_resource *resou /* LCOV_EXCL_STOP */ } + ret = tdm_output_add_change_handler(output, _tdm_server_cb_output_change, output_info); + if (ret != TDM_ERROR_NONE) { + wl_resource_post_no_memory(resource); + wl_resource_destroy(output_resource); + free(output_info); + TDM_ERR("tdm_output_add_change_handler failed"); + return; + } + LIST_ADDTAIL(&output_info->link, &private_server->output_list); output_info->private_server = private_server; output_info->resource = output_resource; output_info->output = output; LIST_INITHEAD(&output_info->vblank_list); - tdm_output_add_change_handler(output, _tdm_server_cb_output_change, output_info); - wl_resource_set_implementation(output_resource, &tdm_output_implementation, output_info, destroy_output_callback); -- 2.7.4