From: Cheoleun Moon Date: Tue, 31 Mar 2020 02:54:53 +0000 (+0900) Subject: Check invalid parameter error X-Git-Tag: submit/tizen/20200403.050222~2^2~20^2 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=ab90b22f32f76482742d3804765d04da59f5e76a;p=platform%2Fcore%2Fapi%2Fwifi-aware.git Check invalid parameter error --- diff --git a/src/wifi-aware-private.c b/src/wifi-aware-private.c index f3d2b66..a9553fd 100644 --- a/src/wifi-aware-private.c +++ b/src/wifi-aware-private.c @@ -534,6 +534,9 @@ int _wifi_aware_disable_request() int _wifi_aware_session_handle_create(wifi_aware_session_type_e session_type, wifi_aware_session_h *session_handle) { + RET_VAL_IF(!session_handle, WIFI_AWARE_ERROR_INVALID_PARAMETER, "Invalid Parameter"); + RET_VAL_IF(session_type != WIFI_AWARE_SESSION_PUBLISH && session_type != WIFI_AWARE_SESSION_SUBSCRIBE, + WIFI_AWARE_ERROR_INVALID_PARAMETER, "Invalid Parameter"); wifi_aware_session_s *session = (wifi_aware_session_s *)g_try_malloc0(sizeof(wifi_aware_session_s)); RET_VAL_IF(session == NULL, WIFI_AWARE_ERROR_OUT_OF_MEMORY, "Out of memory"); @@ -608,6 +611,8 @@ void _wifi_aware_session_unset_terminated_cb(wifi_aware_session_h session) int _wifi_aware_publish_handle_create(wifi_aware_publish_h *publish) { + RET_VAL_IF(publish == NULL, WIFI_AWARE_ERROR_INVALID_PARAMETER, "Invalid Parameter"); + wifi_aware_publish_request_s *req = (wifi_aware_publish_request_s *)g_try_malloc0(sizeof(wifi_aware_publish_request_s)); RET_VAL_IF(req == NULL, WIFI_AWARE_ERROR_OUT_OF_MEMORY, "Out of memory"); @@ -684,6 +689,8 @@ int _wifi_aware_publish_request(wifi_aware_session_h session, RET_VAL_IF(publish == NULL, WIFI_AWARE_ERROR_INVALID_PARAMETER, "wifi_aware_publish_h is NULL"); RET_VAL_IF(!_wifi_aware_session_is_publish_type(session), WIFI_AWARE_ERROR_INVALID_OPERATION, "This session is not for Publish"); + RET_VAL_IF(_wifi_aware_session_get_service_name(session) == NULL, + WIFI_AWARE_ERROR_INVALID_OPERATION, "Service name is NULL"); RET_VAL_IF(__session_is_requested(session), WIFI_AWARE_ERROR_NOW_IN_PROGRESS, "There is a pending request"); @@ -739,6 +746,8 @@ int _wifi_aware_update_publish_request(wifi_aware_session_h session, int _wifi_aware_subscribe_handle_create(wifi_aware_subscribe_h *subscribe) { + RET_VAL_IF(subscribe == NULL, WIFI_AWARE_ERROR_INVALID_PARAMETER, "Invalid Parameter"); + wifi_aware_subscribe_request_s *req = (wifi_aware_subscribe_request_s *)g_try_malloc0(sizeof(wifi_aware_subscribe_request_s)); RET_VAL_IF(req == NULL, WIFI_AWARE_ERROR_OUT_OF_MEMORY, "Out of memory"); @@ -843,6 +852,8 @@ int _wifi_aware_update_subscribe_request(wifi_aware_session_h session, RET_VAL_IF(subscribe == NULL, WIFI_AWARE_ERROR_INVALID_PARAMETER, "wifi_aware_subscribe_h is NULL"); RET_VAL_IF(!_wifi_aware_session_is_subscribe_type(session), WIFI_AWARE_ERROR_INVALID_OPERATION, "This session is not for Subscribe"); + RET_VAL_IF(_wifi_aware_session_get_service_name(session) == NULL, + WIFI_AWARE_ERROR_INVALID_OPERATION, "Service name is NULL"); RET_VAL_IF(!__is_subscribed(session), WIFI_AWARE_ERROR_INVALID_OPERATION, "The subscribe is not done yet"); RET_VAL_IF(__session_is_requested(session), WIFI_AWARE_ERROR_NOW_IN_PROGRESS,