From: Minchul Lee Date: Wed, 18 Nov 2015 04:54:47 +0000 (+0900) Subject: fix prevent 482199 ~ 488631 X-Git-Tag: submit/tizen/20151130.235229~10 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=96d2d682d9278eb0d7d75a2bf710509f83ddb64b;p=platform%2Fcore%2Fiot%2Fiotcon.git fix prevent 482199 ~ 488631 Change-Id: Id919337fcd53641d0b8c376d0d026282bbd5d095 Signed-off-by: Minchul Lee --- diff --git a/daemon/icd-ioty-ocprocess.c b/daemon/icd-ioty-ocprocess.c index 85254e7..5caa70b 100644 --- a/daemon/icd-ioty-ocprocess.c +++ b/daemon/icd-ioty-ocprocess.c @@ -16,7 +16,7 @@ #include #include -#include /* for usleep() */ +#include #include #include @@ -329,6 +329,7 @@ OCEntityHandlerResult icd_ioty_ocprocess_req_handler(OCEntityHandlerFlag flag, dev_addr = calloc(1, sizeof(OCDevAddr)); if (NULL == dev_addr) { ERR("calloc() Fail(%d)", errno); + free(req_ctx->bus_name); free(req_ctx); return OC_EH_ERROR; } @@ -355,6 +356,7 @@ OCEntityHandlerResult icd_ioty_ocprocess_req_handler(OCEntityHandlerFlag flag, req_ctx->payload = NULL; break; default: + free(req_ctx->dev_addr); free(req_ctx->bus_name); free(req_ctx); return OC_EH_ERROR; @@ -406,6 +408,7 @@ gpointer icd_ioty_ocprocess_thread(gpointer data) { FN_CALL; OCStackResult result; + const struct timespec delay = {0, 10 * 1000 * 1000}; /* 10 ms */ icd_ioty_alive = 1; while (icd_ioty_alive) { @@ -417,8 +420,9 @@ gpointer icd_ioty_ocprocess_thread(gpointer data) break; } - /* TODO : SHOULD revise time or usleep */ - usleep(10); + /* TODO : Current '10ms' is not proven sleep time. Revise the time after test. + * Or recommend changes to event driven architecture */ + nanosleep(&delay, NULL); } return NULL; diff --git a/daemon/icd-ioty.c b/daemon/icd-ioty.c index b5f9714..b809ec1 100644 --- a/daemon/icd-ioty.c +++ b/daemon/icd-ioty.c @@ -744,6 +744,7 @@ OCDoHandle icd_ioty_observer_start(GVariant *resource, int observe_policy, context = calloc(1, sizeof(icd_sig_ctx_s)); if (NULL == context) { ERR("calloc() Fail(%d)", errno); + free(uri); return NULL; } context->bus_name = ic_utils_strdup(bus_name); diff --git a/lib/icl-lite-resource.c b/lib/icl-lite-resource.c index a00e08b..ca8355c 100644 --- a/lib/icl-lite-resource.c +++ b/lib/icl-lite-resource.c @@ -139,10 +139,11 @@ static void _icl_lite_resource_request_handler(GDBusConnection *connection, { GVariant *repr_gvar; int ret, request_type; + int64_t oic_request_h = 0; + int64_t oic_resource_h = 0; iotcon_representation_h repr; iotcon_state_h recv_state = NULL; GVariantIter *repr_iter, *state_iter; - int64_t oic_request_h, oic_resource_h; iotcon_lite_resource_h resource = user_data; ret = iotcon_representation_create(&repr);