diff options
| author | Benjamin Poirier <bpoirier@suse.de> | 2013-04-15 10:13:50 -0400 |
|---|---|---|
| committer | Yann E. MORIN <yann.morin.1998@free.fr> | 2013-04-16 15:59:28 -0400 |
| commit | edb749f4390b3c1604233dc7c4fb0361f472e712 (patch) | |
| tree | 2fc01bf1af715d291ad031b30e82e3cfac1e7f47 /scripts/kconfig | |
| parent | a45c7dfb942b6c198d5cd283f8dcee145241a017 (diff) | |
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 <bpoirier@suse.de>
Tested-by: "Yann E. MORIN" <yann.morin.1998@free.fr>
Reviewed-by: "Yann E. MORIN" <yann.morin.1998@free.fr>
Signed-off-by: "Yann E. MORIN" <yann.morin.1998@free.fr>
Cc: stable@vger.kernel.org
Diffstat (limited to 'scripts/kconfig')
| -rw-r--r-- | scripts/kconfig/list.h | 13 | ||||
| -rw-r--r-- | scripts/kconfig/mconf.c | 3 |
2 files changed, 16 insertions, 0 deletions
diff --git a/scripts/kconfig/list.h b/scripts/kconfig/list.h index 0ae730be5f49..b87206cc92f4 100644 --- a/scripts/kconfig/list.h +++ b/scripts/kconfig/list.h | |||
| @@ -51,6 +51,19 @@ struct list_head { | |||
| 51 | pos = list_entry(pos->member.next, typeof(*pos), member)) | 51 | pos = list_entry(pos->member.next, typeof(*pos), member)) |
| 52 | 52 | ||
| 53 | /** | 53 | /** |
| 54 | * list_for_each_entry_safe - iterate over list of given type safe against removal of list entry | ||
| 55 | * @pos: the type * to use as a loop cursor. | ||
| 56 | * @n: another type * to use as temporary storage | ||
| 57 | * @head: the head for your list. | ||
| 58 | * @member: the name of the list_struct within the struct. | ||
| 59 | */ | ||
| 60 | #define list_for_each_entry_safe(pos, n, head, member) \ | ||
| 61 | for (pos = list_entry((head)->next, typeof(*pos), member), \ | ||
| 62 | n = list_entry(pos->member.next, typeof(*pos), member); \ | ||
| 63 | &pos->member != (head); \ | ||
| 64 | pos = n, n = list_entry(n->member.next, typeof(*n), member)) | ||
| 65 | |||
| 66 | /** | ||
| 54 | * list_empty - tests whether a list is empty | 67 | * list_empty - tests whether a list is empty |
| 55 | * @head: the list to test. | 68 | * @head: the list to test. |
| 56 | */ | 69 | */ |
diff --git a/scripts/kconfig/mconf.c b/scripts/kconfig/mconf.c index 566288a76370..c5418d622a05 100644 --- a/scripts/kconfig/mconf.c +++ b/scripts/kconfig/mconf.c | |||
| @@ -389,6 +389,7 @@ again: | |||
| 389 | .targets = targets, | 389 | .targets = targets, |
| 390 | .keys = keys, | 390 | .keys = keys, |
| 391 | }; | 391 | }; |
| 392 | struct jump_key *pos, *tmp; | ||
| 392 | 393 | ||
| 393 | res = get_relations_str(sym_arr, &head); | 394 | res = get_relations_str(sym_arr, &head); |
| 394 | dres = show_textbox_ext(_("Search Results"), (char *) | 395 | dres = show_textbox_ext(_("Search Results"), (char *) |
| @@ -402,6 +403,8 @@ again: | |||
| 402 | again = true; | 403 | again = true; |
| 403 | } | 404 | } |
| 404 | str_free(&res); | 405 | str_free(&res); |
| 406 | list_for_each_entry_safe(pos, tmp, &head, entries) | ||
| 407 | free(pos); | ||
| 405 | } while (again); | 408 | } while (again); |
| 406 | free(sym_arr); | 409 | free(sym_arr); |
| 407 | str_free(&title); | 410 | str_free(&title); |
