From: Benjamin Poirier <bpoirier@suse.de>
To: Michal Marek <mmarek@suse.cz>
Cc: "Yann E. MORIN" <yann.morin.1998@free.fr>,
Wang YanQing <udknight@gmail.com>,
Dirk Gouders <gouders@et.bocholt.fh-gelsenkirchen.de>,
Paul Gortmaker <paul.gortmaker@windriver.com>,
linux-kbuild@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: [PATCH 1/2] menuconfig: Fix memory leak introduced by jump keys feature
Date: Mon, 15 Apr 2013 10:13:50 -0400 [thread overview]
Message-ID: <1366035231-24370-1-git-send-email-bpoirier@suse.de> (raw)
Fixes the memory leak of struct jump_key allocated in get_prompt_str()
Signed-off-by: Benjamin Poirier <bpoirier@suse.de>
---
scripts/kconfig/list.h | 13 +++++++++++++
scripts/kconfig/mconf.c | 3 +++
2 files changed, 16 insertions(+)
diff --git a/scripts/kconfig/list.h b/scripts/kconfig/list.h
index 0ae730b..b87206c 100644
--- a/scripts/kconfig/list.h
+++ b/scripts/kconfig/list.h
@@ -51,6 +51,19 @@ struct list_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.
*/
diff --git a/scripts/kconfig/mconf.c b/scripts/kconfig/mconf.c
index 566288a..c5418d6 100644
--- a/scripts/kconfig/mconf.c
+++ b/scripts/kconfig/mconf.c
@@ -389,6 +389,7 @@ again:
.targets = targets,
.keys = keys,
};
+ struct jump_key *pos, *tmp;
res = get_relations_str(sym_arr, &head);
dres = show_textbox_ext(_("Search Results"), (char *)
@@ -402,6 +403,8 @@ again:
again = true;
}
str_free(&res);
+ list_for_each_entry_safe(pos, tmp, &head, entries)
+ free(pos);
} while (again);
free(sym_arr);
str_free(&title);
--
1.7.10.4
next reply other threads:[~2013-04-15 14:14 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-04-15 14:13 Benjamin Poirier [this message]
2013-04-15 14:13 ` [PATCH 2/2] menuconfig: Add "breadcrumbs" navigation aid Benjamin Poirier
2013-04-15 21:39 ` Yann E. MORIN
2013-04-16 14:07 ` [PATCH v3] " Benjamin Poirier
2013-04-16 17:20 ` Yann E. MORIN
2013-04-15 21:54 ` [PATCH 1/2] menuconfig: Fix memory leak introduced by jump keys feature Yann E. MORIN
2013-04-16 8:21 ` Michal Marek
2013-04-16 9:12 ` Michal Marek
2013-04-16 16:38 ` Yann E. MORIN
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1366035231-24370-1-git-send-email-bpoirier@suse.de \
--to=bpoirier@suse.de \
--cc=gouders@et.bocholt.fh-gelsenkirchen.de \
--cc=linux-kbuild@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mmarek@suse.cz \
--cc=paul.gortmaker@windriver.com \
--cc=udknight@gmail.com \
--cc=yann.morin.1998@free.fr \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®