lkml.org 
[lkml]   [2005]   [Oct]   [16]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
Subject[OT] Re: PROBLEM: memory leak in LIST_*, TAILQ_* man page
From
In article <43530379.6040504@vocalabs.com> (at Sun, 16 Oct 2005 20:50:49 -0500), David Leppik <dleppik@vocalabs.com> says:

> The man page for TAILQ_REMOVE, etc. contains the following sample code:
>
> while (head.tqh_first != NULL)
> TAILQ_REMOVE(&head, head.tqh_first, entries);
>
> I checked /usr/include/sys/queue.h and, sure enough, TAILQ_REMOVE
> doesn't free
> head.tqh_first. Nor should it-- this isn't Objective-C, after all. :-)
>
> It should be something like:
>
> while (head.tqh_first != NULL) {
> np = head.tqh_first;
> TAILQ_REMOVE(&head, np, entries);
> free(np);
> }

Wrong. People do not always destroy the item removed
from the list, I think.

--yoshfuji
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/

\
 
 \ /
  Last update: 2005-10-17 04:21    [W:0.030 / U:0.684 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site