Commit c37642db authored by Vikas Gupta's avatar Vikas Gupta Committed by Erich Keane

Memory Leak recources not released in case of failure.

Multiple Mutex are initialized in this function, if one of them fails
previous allocated resources should be released.

Change-Id: I869cfce4dce6c3858443833df523b6234eae3761
Signed-off-by: default avatarVikas Gupta <vs.gupta@samsung.com>
Reviewed-on: https://gerrit.iotivity.org/gerrit/1664Tested-by: default avatarjenkins-iotivity <jenkins-iotivity@opendaylight.org>
Reviewed-by: default avatarErich Keane <erich.keane@intel.com>
parent a22ce6af
......@@ -1146,6 +1146,7 @@ CAResult_t CAInitLEAdapterMutex()
if (NULL == g_bleNetworkCbMutex)
{
OIC_LOG(ERROR, CALEADAPTER_TAG, "ca_mutex_new failed");
CATerminateLEAdapterMutex();
return CA_STATUS_FAILED;
}
}
......@@ -1156,6 +1157,7 @@ CAResult_t CAInitLEAdapterMutex()
if (NULL == g_bleLocalAddressMutex)
{
OIC_LOG(ERROR, CALEADAPTER_TAG, "ca_mutex_new failed");
CATerminateLEAdapterMutex();
return CA_STATUS_FAILED;
}
}
......@@ -1166,6 +1168,7 @@ CAResult_t CAInitLEAdapterMutex()
if (NULL == g_bleAdapterThreadPoolMutex)
{
OIC_LOG(ERROR, CALEADAPTER_TAG, "ca_mutex_new failed");
CATerminateLEAdapterMutex();
return CA_STATUS_FAILED;
}
}
......@@ -1176,6 +1179,7 @@ CAResult_t CAInitLEAdapterMutex()
if (NULL == g_bleClientSendDataMutex)
{
OIC_LOG(ERROR, CALEADAPTER_TAG, "ca_mutex_new failed");
CATerminateLEAdapterMutex();
return CA_STATUS_FAILED;
}
}
......@@ -1186,6 +1190,7 @@ CAResult_t CAInitLEAdapterMutex()
if (NULL == g_bleClientReceiveDataMutex)
{
OIC_LOG(ERROR, CALEADAPTER_TAG, "ca_mutex_new failed");
CATerminateLEAdapterMutex();
return CA_STATUS_FAILED;
}
}
......@@ -1196,6 +1201,7 @@ CAResult_t CAInitLEAdapterMutex()
if (NULL == g_bleServerSendDataMutex)
{
OIC_LOG(ERROR, CALEADAPTER_TAG, "ca_mutex_new failed");
CATerminateLEAdapterMutex();
return CA_STATUS_FAILED;
}
}
......@@ -1206,6 +1212,7 @@ CAResult_t CAInitLEAdapterMutex()
if (NULL == g_bleServerReceiveDataMutex)
{
OIC_LOG(ERROR, CALEADAPTER_TAG, "ca_mutex_new failed");
CATerminateLEAdapterMutex();
return CA_STATUS_FAILED;
}
}
......@@ -1216,6 +1223,7 @@ CAResult_t CAInitLEAdapterMutex()
if (NULL == g_bleAdapterReqRespCbMutex)
{
OIC_LOG(ERROR, CALEADAPTER_TAG, "ca_mutex_new failed");
CATerminateLEAdapterMutex();
return CA_STATUS_FAILED;
}
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment