[5/6] kconfig: don't allocate n+1 elements in temporary array
diff mbox

Message ID 1407f97aeda5720d6327d69f6058537c0fd469e3.1374006854.git.yann.morin.1998@free.fr
State New, archived
Headers show

Commit Message

Yann E. MORIN July 16, 2013, 8:40 p.m. UTC
From: "Yann E. MORIN" <yann.morin.1998@free.fr>

The temporary array that stores the search results is not NULL-terminated,
so there is no reason to allocate n+1 elements.

Reported-by: Jean Delvare <jdelvare@suse.de>
Signed-off-by: "Yann E. MORIN" <yann.morin.1998@free.fr>
Reviewed-by: Jean Delvare <jdelvare@suse.de>
---
 scripts/kconfig/symbol.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Patch
diff mbox

diff --git a/scripts/kconfig/symbol.c b/scripts/kconfig/symbol.c
index b664d6e..08d4401 100644
--- a/scripts/kconfig/symbol.c
+++ b/scripts/kconfig/symbol.c
@@ -1010,7 +1010,7 @@  struct symbol **sym_re_search(const char *pattern)
 			continue;
 		if (regexec(&re, sym->name, 1, match, 0))
 			continue;
-		if (cnt + 1 >= size) {
+		if (cnt >= size) {
 			void *tmp;
 			size += 16;
 			tmp = realloc(sym_match_arr, size * sizeof(struct sym_match *));