AVSystem / Anjay

C implementation of the client-side OMA LwM2M protocol
Other
188 stars 68 forks source link

Getting segmentation fault after executing find_instance function #32

Closed samueldacunha closed 4 years ago

samueldacunha commented 4 years ago

I included a humidity instance OID = 3304 in the demo. When running the demo, client connects with the DMP and when executing a read on /3304/0/5700 the demo crashes because find_instance returns null

This line:

humidity_instance_t *inst = find_instance(obj, iid);

static humidity_instance_t find_instance(const humidity_t obj, anjay_iid_t iid) { AVS_LIST(humidity_instance_t) it; AVS_LIST_FOREACH(it, obj->instances) { if (it->iid == iid) { return it; } else if (it->iid > iid) { break; } }

return NULL;

}

Always returning NULL

Am I missing something?

samueldacunha commented 4 years ago

I am Working with Single instance object so I noticed I still don't use this function. Maybe I'll come back with questions when I'm working with multiple instance objects. I will close this issuefor now. Thank you and apologies.