From: Benjamin Poirier Date: Mon, 15 Apr 2013 14:13:50 +0000 (-0400) Subject: menuconfig: Fix memory leak introduced by jump keys feature X-Git-Tag: 1.9.9~38 X-Git-Url: https://jxself.org/git/?a=commitdiff_plain;h=6da709bd7e0a559edd4313aa894e56da5606dc7b;p=carl9170fw.git menuconfig: Fix memory leak introduced by jump keys feature Fixes the memory leak of struct jump_key allocated in get_prompt_str() Signed-off-by: Benjamin Poirier Tested-by: "Yann E. MORIN" Reviewed-by: "Yann E. MORIN" Signed-off-by: "Yann E. MORIN" Cc: stable@vger.kernel.org Signed-off-by: Christian Lamparter --- diff --git a/config/list.h b/config/list.h index 0ae730b..b87206c 100644 --- a/config/list.h +++ b/config/list.h @@ -50,6 +50,19 @@ struct list_head { &pos->member != (head); \ pos = list_entry(pos->member.next, typeof(*pos), member)) +/** + * list_for_each_entry_safe - iterate over list of given type safe against removal of list entry + * @pos: the type * to use as a loop cursor. + * @n: another type * to use as temporary storage + * @head: the head for your list. + * @member: the name of the list_struct within the struct. + */ +#define list_for_each_entry_safe(pos, n, head, member) \ + for (pos = list_entry((head)->next, typeof(*pos), member), \ + n = list_entry(pos->member.next, typeof(*pos), member); \ + &pos->member != (head); \ + pos = n, n = list_entry(n->member.next, typeof(*n), member)) + /** * list_empty - tests whether a list is empty * @head: the list to test.