AVSystem / Anjay

C implementation of the client-side OMA LwM2M protocol

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Getting segmentation fault after executing find_instance function

samueldacunha opened this issue · comments

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?

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.