From: Jay Sharma Date: Fri, 9 Jun 2017 06:39:31 +0000 (+0530) Subject: [NS] Notification consumer valgrind invalid read/write fix. X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=b3dce20b736efd7b8c06eeba8c7ece57237ac38e;p=platform%2Fupstream%2Fiotivity.git [NS] Notification consumer valgrind invalid read/write fix. Bug: https://jira.iotivity.org/browse/IOT-2373 Change-Id: Ifd3789538c3d368b7ca3da52d274bb7ed531c126 Signed-off-by: Jay Sharma Reviewed-on: https://gerrit.iotivity.org/gerrit/20831 Tested-by: jenkins-iotivity Reviewed-by: Habib Virji (cherry picked from commit bdc2263c344879854b914ec5efd0e232137c49c2) Reviewed-on: https://gerrit.iotivity.org/gerrit/20663 Reviewed-by: Uze Choi Reviewed-by: Phil Coval Reviewed-by: George Nash --- diff --git a/service/notification/src/consumer/NSConsumerScheduler.c b/service/notification/src/consumer/NSConsumerScheduler.c index 9d706e6..c313453 100644 --- a/service/notification/src/consumer/NSConsumerScheduler.c +++ b/service/notification/src/consumer/NSConsumerScheduler.c @@ -207,12 +207,14 @@ void * NSConsumerMsgHandleThreadFunc(void * threadHandle) void * NSConsumerMsgPushThreadFunc(void * data) { + pthread_mutex_lock(&g_start_mutex); NSConsumerQueueObject * obj = NULL; NS_LOG(DEBUG, "get queueThread handle"); if (NULL == g_handle) { NSOICFree(data); + pthread_mutex_unlock(&g_start_mutex); return NULL; } NSThreadLock(g_handle); @@ -222,6 +224,7 @@ void * NSConsumerMsgPushThreadFunc(void * data) NS_VERIFY_NOT_NULL_WITH_POST_CLEANING(obj, NULL, { NSThreadUnlock(g_handle); + pthread_mutex_unlock(&g_start_mutex); NSOICFree(data); }); @@ -241,6 +244,7 @@ void * NSConsumerMsgPushThreadFunc(void * data) } NSThreadUnlock(g_handle); + pthread_mutex_unlock(&g_start_mutex); return NULL; }