From 8901194db49bdedc5a5a36e94a51f4d7cd538347 Mon Sep 17 00:00:00 2001 From: Kwangyoun Kim Date: Wed, 5 Oct 2016 18:34:43 +0900 Subject: [PATCH] Fix typo and add error handling Change-Id: I6d1d39fb11ece24b6521c18cad3e18a4ea4ec27e --- client/vc_mgr_client.c | 6 ++++++ include/voice_control_manager.h | 3 ++- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/client/vc_mgr_client.c b/client/vc_mgr_client.c index 4f01521..328ff33 100644 --- a/client/vc_mgr_client.c +++ b/client/vc_mgr_client.c @@ -706,6 +706,9 @@ int vc_mgr_client_set_error_message(vc_h vc, const char* err_msg) if (NULL != err_msg) { client->err_msg = strdup(err_msg); + if (NULL == client->err_msg) { + return VC_ERROR_OUT_OF_MEMORY; + } } return 0; @@ -721,6 +724,9 @@ int vc_mgr_client_get_error_message(vc_h vc, char** err_msg) if (NULL != client->err_msg) { *err_msg = strdup(client->err_msg); + if (NULL == *err_msg) { + return VC_ERROR_OUT_OF_MEMORY; + } } return 0; diff --git a/include/voice_control_manager.h b/include/voice_control_manager.h index abcd864..32f4cd7 100644 --- a/include/voice_control_manager.h +++ b/include/voice_control_manager.h @@ -904,7 +904,7 @@ int vc_mgr_unset_current_language_changed_cb(); /** * @brief Gets the current error message. * -* @remarks This function should be called during as stt error callback. If not, the error as operation failure will be returned. \n +* @remarks This function should be called during as vc error callback. If not, the error as operation failure will be returned. \n * If the function succeeds, @a err_msg must be released using free() when it is no longer required. * * @param[out] err_msg The current error message @@ -914,6 +914,7 @@ int vc_mgr_unset_current_language_changed_cb(); * @retval #VC_ERROR_INVALID_PARAMETER Invalid parameter * @retval #VC_ERROR_INVALID_STATE Invalid state * @retval $VC_ERROR_OPERATION_FAILED Operation failure +* @retval #VC_ERROR_OUT_OF_MEMORY Out of memory * * @see vc_error_cb() */ -- 2.7.4