From: Andreas Schneider Date: Wed, 21 Mar 2018 15:46:49 +0000 (+0100) Subject: s4:registry: Fix size type and loop X-Git-Tag: talloc-2.1.13~80 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=c4a73ccd8f23eceae3ee598d9841860e7342230d;p=thirdparty%2Fsamba.git s4:registry: Fix size type and loop This fixes compilation with -Wstrict-overflow=2. Signed-off-by: Andreas Schneider Reviewed-by: Jeremy Allison --- diff --git a/source4/lib/registry/tools/regshell.c b/source4/lib/registry/tools/regshell.c index 5308d30e849..48251c33ea4 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;