Nios® V/II Embedded Design Suite (EDS)
Support for Embedded Development Tools, Processors (SoCs and Nios® V/II processor), Embedded Development Suites (EDSs), Boot and Configuration, Operating Systems, C and C++

Tail Queue Remove

Altera_Forum
Honored Contributor II
1,003 Views

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;
0 Kudos
0 Replies
Reply