From c4a73ccd8f23eceae3ee598d9841860e7342230d Mon Sep 17 00:00:00 2001 From: Andreas Schneider Date: Wed, 21 Mar 2018 16:46:49 +0100 Subject: [PATCH] s4:registry: Fix size type and loop This fixes compilation with -Wstrict-overflow=2. Signed-off-by: Andreas Schneider Reviewed-by: Jeremy Allison --- source4/lib/registry/tools/regshell.c | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/source4/lib/registry/tools/regshell.c b/source4/lib/registry/tools/regshell.c index 5308d30e8496..48251c33ea4a 100644 --- a/source4/lib/registry/tools/regshell.c +++ b/source4/lib/registry/tools/regshell.c @@ -428,7 +428,7 @@ static char **reg_complete_command(const char *text, int start, int end) /* Complete command */ char **matches; size_t len, samelen=0; - int i, count=1; + size_t i, count = 1; matches = malloc_array_p(char *, MAX_COMPLETIONS); if (!matches) return NULL; @@ -463,10 +463,8 @@ static char **reg_complete_command(const char *text, int start, int end) return matches; cleanup: - count--; - while (count >= 0) { - free(matches[count]); - count--; + for (i = 0; i < count; i++) { + free(matches[i]); } free(matches); return NULL; -- 2.34.1