Forum Discussion

Altera_Forum's avatar
Altera_Forum
Icon for Honored Contributor rankHonored Contributor
19 years ago

Tail Queue Remove

currently using uCLinux 2.6, and thinking about using Tail Queue. Based on the example here:

http://linux.about.com/library/cmd/blcmdl3_queue.htm (http://linux.about.com/library/cmd/blcmdl3_queue.htm)

Everytime an item is added, malloc is called. However, when I looked into the remove implementation, free isn't called. Question is: will this lead to memory leak eventually?

I attach the TAILQ_REMOVE implementation here.

# define TAILQ_REMOVE(head, elm, field) {

if (((elm)->field.tqe_next) != NULL)

(elm)->field.tqe_next->field.tqe_prev =

(elm)->field.tqe_prev;

else

(head)->tqh_last = (elm)->field.tqe_prev;

*(elm)->field.tqe_prev = (elm)->field.tqe_next;
No RepliesBe the first to reply