Skip to content

Commit

Permalink
Merge pull request #300 from sbertin-telular/memory_leaks
Browse files Browse the repository at this point in the history
Fix some memory leaks
  • Loading branch information
dnav committed Jun 7, 2017
2 parents bc7547c + 3cd572a commit 3947387
Showing 1 changed file with 11 additions and 2 deletions.
13 changes: 11 additions & 2 deletions core/observe.c
Original file line number Diff line number Diff line change
Expand Up @@ -259,6 +259,7 @@ void observe_cancel(lwm2m_context_t * contextP,
}
if (targetP != NULL)
{
if (targetP->parameters != NULL) lwm2m_free(targetP->parameters);
lwm2m_free(targetP);
if (observedP->watcherList == NULL)
{
Expand Down Expand Up @@ -504,11 +505,19 @@ void observe_step(lwm2m_context_t * contextP,
switch (dataP->type)
{
case LWM2M_TYPE_INTEGER:
if (1 != lwm2m_data_decode_int(dataP, &integerValue)) continue;
if (1 != lwm2m_data_decode_int(dataP, &integerValue))
{
lwm2m_data_free(size, dataP);
continue;
}
storeValue = true;
break;
case LWM2M_TYPE_FLOAT:
if (1 != lwm2m_data_decode_float(dataP, &floatValue)) continue;
if (1 != lwm2m_data_decode_float(dataP, &floatValue))
{
lwm2m_data_free(size, dataP);
continue;
}
storeValue = true;
break;
default:
Expand Down

0 comments on commit 3947387

Please sign in to comment.