memory handling improvement

This commit is contained in:
suvendhu 2023-06-14 14:51:26 +05:30
parent 4775925cb4
commit ac7410a726

View file

@ -677,19 +677,23 @@ void icwmp_free(void *m)
return; return;
struct cwmp_mem *rm; struct cwmp_mem *rm;
rm = container_of(m, struct cwmp_mem, mem); rm = container_of(m, struct cwmp_mem, mem);
if (rm != NULL) {
list_del(&rm->list); list_del(&rm->list);
free(rm); free(rm);
} }
}
void icwmp_cleanmem() void icwmp_cleanmem()
{ {
struct cwmp_mem *mem; struct cwmp_mem *mem;
while (cwmp_memory_list.next != &cwmp_memory_list) { while (cwmp_memory_list.next != &cwmp_memory_list) {
mem = list_entry(cwmp_memory_list.next, struct cwmp_mem, list); mem = list_entry(cwmp_memory_list.next, struct cwmp_mem, list);
if (mem != NULL) {
list_del(&mem->list); list_del(&mem->list);
free(mem); free(mem);
} }
} }
}
/* /*
* Services Management * Services Management