Destroy cmd list after use 52/178152/2 accepted/tizen/unified/20180521.003637 submit/tizen/20180518.043028
authorWonnam Jang <wn.jang@samsung.com>
Tue, 8 May 2018 09:54:55 +0000 (18:54 +0900)
committerWonnam Jang <wn.jang@samsung.com>
Tue, 8 May 2018 09:55:52 +0000 (18:55 +0900)
Change-Id: I3c2473cde20de094eafff87b4406ccaae015714d
Signed-off-by: Wonnam Jang <wn.jang@samsung.com>
server/vcd_server.c

index 5ac1869..baee35e 100644 (file)
@@ -751,11 +751,12 @@ int vcd_send_result(vce_result_event_e event, int* result_id, int count, const c
 
        // There are more than one result.
        if (false == vcd_client_manager_get_exclusive()) {
+               vc_cmd_list_h temp_list = NULL;
+
                /* Foreground, Widget, Background, System, System-Background */
                if (top_priority >= VC_COMMAND_PRIORITY_BACKGROUND) {
                        vc_cmd_list_h widget_cmd_list = NULL;
                        vc_cmd_list_h foreground_cmd_list = NULL;
-                       vc_cmd_list_h temp_list = NULL;
                        int cnt = 0;
 
                        if (0 != vc_cmd_list_create(&temp_list)) {
@@ -815,7 +816,6 @@ int vcd_send_result(vce_result_event_e event, int* result_id, int count, const c
                                vc_cmd_list_destroy(foreground_cmd_list, true);
                        }
                        vc_cmd_list_destroy(widget_cmd_list, true);
-                       vc_cmd_list_destroy(temp_list, true);
                }
 
                int pid = vcd_client_widget_get_foreground_pid();
@@ -825,6 +825,7 @@ int vcd_send_result(vce_result_event_e event, int* result_id, int count, const c
                }
 
                vc_info_parser_set_result(all_result, event, msg, vc_cmd_list, false);
+               vc_cmd_list_destroy(vc_cmd_list, true);
 
                if (-1 != vcd_client_manager_get_pid()) {
                        /* Manager client is available */
@@ -838,6 +839,7 @@ int vcd_send_result(vce_result_event_e event, int* result_id, int count, const c
        } else {
                /* exclusive command */
                vc_info_parser_set_result(all_result, event, msg, vc_cmd_list, true);
+               vc_cmd_list_destroy(vc_cmd_list, true);
 
                if (-1 != vcd_client_manager_get_pid()) {
                        /* Manager client is available */
@@ -851,8 +853,6 @@ int vcd_send_result(vce_result_event_e event, int* result_id, int count, const c
                vcd_client_manager_set_exclusive(false);
        }
 
-       vc_cmd_list_destroy(vc_cmd_list, true);
-
        if (VCD_RECOGNITION_MODE_RESTART_AFTER_REJECT == recognition_mode) {
                if (VCE_RESULT_EVENT_REJECTED == event) {
                        SLOG(LOG_DEBUG, TAG_VCD, "[Server] Restart by no or rejected result");