mirror of
https://github.com/SELinuxProject/selinux
synced 2025-03-25 12:16:42 +00:00
checkpolicy: do not leak queue elements in queue_destroy()
Elements which are inserted into a queue_t object are either NULL (from insert_separator()) or strings allocated with malloc() in insert_id(). They would be freed if there are still present in the queue when it is destroyed. Otherwise the memory allocated for these elements would be leaked. Signed-off-by: Nicolas Iooss <nicolas.iooss@m4x.org>
This commit is contained in:
parent
6ef96094d3
commit
47f61b0ee9
@ -113,6 +113,7 @@ void queue_destroy(queue_t q)
|
||||
|
||||
p = q->head;
|
||||
while (p != NULL) {
|
||||
free(p->element);
|
||||
temp = p;
|
||||
p = p->next;
|
||||
free(temp);
|
||||
|
Loading…
Reference in New Issue
Block a user