From: Yann E. MORIN Date: Tue, 16 Jul 2013 18:32:33 +0000 (+0200) Subject: kconfig: don't allocate n+1 elements in temporary array X-Git-Tag: 1.9.9~11 X-Git-Url: https://jxself.org/git/?p=carl9170fw.git;a=commitdiff_plain;h=26f53e834095e19dfc7cf18b2683c618d98bd9e7 kconfig: don't allocate n+1 elements in temporary array 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 Signed-off-by: "Yann E. MORIN" Reviewed-by: Jean Delvare Signed-off-by: Christian Lamparter --- diff --git a/config/symbol.c b/config/symbol.c index b664d6e..08d4401 100644 --- a/config/symbol.c +++ b/config/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 *));