[CONPRO-1176] iotivity crash during CAReceiveMessage
[platform/upstream/iotivity.git] / resource / csdk / connectivity / src / adapter_util / ca_adapter_net_ssl.c
index 73831e4..b953c35 100644 (file)
@@ -1410,9 +1410,9 @@ static void RemovePeerFromList(const CAEndpoint_t * endpoint)
                 && (endpoint->port == tep->sep.endpoint.port || CA_ADAPTER_GATT_BTLE == endpoint->adapter))
         {
             u_arraylist_remove(g_caSslContext->peerList, listIndex);
-            DeleteSslEndPoint(tep);
             OIC_LOG_V(INFO, NET_SSL_TAG, "Remove Peer:[%s:%d] for %d adapter",
                     endpoint->addr, endpoint->port, endpoint->adapter);
+            DeleteSslEndPoint(tep);
             OIC_LOG_V(DEBUG, NET_SSL_TAG, "Out %s", __func__);
             return;
         }