Skip to content

Commit

Permalink
kconfig: don't allocate n+1 elements in temporary array
Browse files Browse the repository at this point in the history
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 <[email protected]>
Signed-off-by: "Yann E. MORIN" <[email protected]>
Reviewed-by: Jean Delvare <[email protected]>
  • Loading branch information
yann-morin-1998 committed Jul 16, 2013
1 parent 803b351 commit 1407f97
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion scripts/kconfig/symbol.c
Original file line number Diff line number Diff line change
Expand Up @@ -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 *));
Expand Down

0 comments on commit 1407f97

Please sign in to comment.