server: check return value 62/171062/2
authorBoram Park <boram1288.park@samsung.com>
Mon, 26 Feb 2018 06:36:14 +0000 (15:36 +0900)
committerBoram Park <boram1288.park@samsung.com>
Mon, 26 Feb 2018 23:50:59 +0000 (08:50 +0900)
Change-Id: I6efd4944ec752d7b9ce70ed67a2ef73021b1f1f1

src/tdm_server.c

index 840e575..f5e222a 100644 (file)
@@ -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);