if (NULL != client->all_result_text) {
free(client->all_result_text);
+ client->all_result_text = NULL;
+ }
+ if (NULL != result_text) {
+ client->all_result_text = strdup(result_text);
}
- client->all_result_text = strdup(result_text);
return 0;
}
int vc_info_parser_set_result(const char* result_text, int event, const char* msg, vc_cmd_list_h vc_cmd_list, bool exclusive)
{
- int ret = vc_db_insert_result(result_text, event, msg, vc_cmd_list, exclusive);
+ char* temp_text = NULL;
+ if (NULL == result_text) {
+ temp_text = strdup("#NULL");
+ } else {
+ temp_text = strdup(result_text);
+ }
+
+ int ret = vc_db_insert_result(temp_text, event, msg, vc_cmd_list, exclusive);
if (0 != ret) {
SLOG(LOG_ERROR, vc_info_tag(), "[ERROR] Insert db is failed, ret = %d", ret);
}
SLOG(LOG_DEBUG, vc_info_tag(), "[Success] Save result command file");
+
+ if (NULL != temp_text) {
+ free(temp_text);
+ temp_text = NULL;
+ }
+
return ret;
}
return -1;
}
- int ret = vc_db_get_result(result_text, event, result_message, pid, vc_cmd_list, exclusive);
+ char* temp_text = NULL;
+ int ret = vc_db_get_result(&temp_text, event, result_message, pid, vc_cmd_list, exclusive);
if (0 != ret) {
SLOG(LOG_ERROR, vc_info_tag(), "[ERROR] Insert db is failed, ret = %d", ret);
}
+
+ if (!strcmp(temp_text, "#NULL")) {
+ *result_text = NULL;
+ } else {
+ *result_text = strdup(temp_text);
+ }
+
+ if (NULL != temp_text) {
+ free(temp_text);
+ temp_text = NULL;
+ }
+
return ret;
}
}
return 0;
-}
\ No newline at end of file
+}
/* No result */
if (NULL != all_result) {
SLOG(LOG_DEBUG, TAG_VCD, "[Server] Engine result is no command : %s", all_result);
- bool temp = vcd_client_manager_get_exclusive();
- vc_info_parser_set_result(all_result, event, msg, NULL, temp);
+ } else {
+ SLOG(LOG_DEBUG, TAG_VCD, "[Server] Engine result is NULL");
}
+ bool temp = vcd_client_manager_get_exclusive();
+ vc_info_parser_set_result(all_result, event, msg, NULL, temp);
int pid = vcd_client_widget_get_foreground_pid();
if (-1 != pid) {