@@ -1721,8 +1721,7 @@ static lwm2m_client_t * prv_getClientByName(lwm2m_context_t * contextP,
1721
1721
return targetP ;
1722
1722
}
1723
1723
1724
- void registration_freeClient (lwm2m_client_t * clientP )
1725
- {
1724
+ void registration_freeClient (lwm2m_context_t * const context , lwm2m_client_t * clientP ) {
1726
1725
LOG_DBG ("Entering" );
1727
1726
if (clientP -> name != NULL ) lwm2m_free (clientP -> name );
1728
1727
if (clientP -> msisdn != NULL ) lwm2m_free (clientP -> msisdn );
@@ -1744,6 +1743,8 @@ void registration_freeClient(lwm2m_client_t * clientP)
1744
1743
1745
1744
free_block_data (targetP );
1746
1745
}
1746
+ transaction_remove_client (context , clientP );
1747
+ lwm2m_session_remove (clientP -> sessionH );
1747
1748
lwm2m_free (clientP );
1748
1749
}
1749
1750
@@ -1858,7 +1859,7 @@ uint8_t registration_handleRequest(lwm2m_context_t * contextP,
1858
1859
{
1859
1860
lwm2m_client_t * tmpClientP = utils_findClient (contextP , fromSessionH );
1860
1861
contextP -> clientList = (lwm2m_client_t * )LWM2M_LIST_RM (contextP -> clientList , tmpClientP -> internalID , & tmpClientP );
1861
- registration_freeClient (tmpClientP );
1862
+ registration_freeClient (contextP , tmpClientP );
1862
1863
}
1863
1864
}
1864
1865
if (clientP != NULL )
@@ -1898,12 +1899,12 @@ uint8_t registration_handleRequest(lwm2m_context_t * contextP,
1898
1899
1899
1900
if (prv_getLocationString (clientP -> internalID , location ) == 0 )
1900
1901
{
1901
- registration_freeClient (clientP );
1902
+ registration_freeClient (contextP , clientP );
1902
1903
return COAP_500_INTERNAL_SERVER_ERROR ;
1903
1904
}
1904
1905
if (coap_set_header_location_path (response , location ) == 0 )
1905
1906
{
1906
- registration_freeClient (clientP );
1907
+ registration_freeClient (contextP , clientP );
1907
1908
return COAP_500_INTERNAL_SERVER_ERROR ;
1908
1909
}
1909
1910
@@ -2023,7 +2024,7 @@ uint8_t registration_handleRequest(lwm2m_context_t * contextP,
2023
2024
{
2024
2025
contextP -> monitorCallback (contextP , clientP -> internalID , NULL , COAP_202_DELETED , NULL , LWM2M_CONTENT_TEXT , NULL , 0 , contextP -> monitorUserData );
2025
2026
}
2026
- registration_freeClient (clientP );
2027
+ registration_freeClient (contextP , clientP );
2027
2028
result = COAP_202_DELETED ;
2028
2029
}
2029
2030
break ;
@@ -2143,7 +2144,7 @@ void registration_step(lwm2m_context_t * contextP,
2143
2144
{
2144
2145
contextP -> monitorCallback (contextP , clientP -> internalID , NULL , COAP_202_DELETED , NULL , LWM2M_CONTENT_TEXT , NULL , 0 , contextP -> monitorUserData );
2145
2146
}
2146
- registration_freeClient (clientP );
2147
+ registration_freeClient (contextP , clientP );
2147
2148
}
2148
2149
else
2149
2150
{
0 commit comments