[lxc-devel] [PATCH] Fix use of list item memory after free

Dwight Engen dwight.engen at oracle.com
Mon Nov 26 17:58:54 UTC 2012


On Mon, 26 Nov 2012 11:40:40 -0600
Serge Hallyn <serge.hallyn at canonical.com> wrote:

> Quoting Dwight Engen (dwight.engen at oracle.com):
> > Valgrind showed use of ->next field after item has been free()ed.
> > Introduce a lxc_list_for_each_safe() which allows traversal of a
> > list when the body of the loop may remove the currently iterated
> > item.
> > 
> > Signed-off-by: Dwight Engen <dwight.engen at oracle.com>
> 
> Thanks (boy do I feel like an idiot)
> 
> Acked-by: Serge E. Hallyn <serge.hallyn at ubuntu.com>

No big deal, I guess it would only affect the threaded case where
another thread picked up the free()ed memory as we iterated. I only
noticed because of valgrind :)




More information about the lxc-devel mailing list