diff options
author | Andreas Schneider <asn@samba.org> | 2018-03-21 16:46:49 +0100 |
---|---|---|
committer | Jeremy Allison <jra@samba.org> | 2018-04-03 20:20:10 +0200 |
commit | c4a73ccd8f23eceae3ee598d9841860e7342230d (patch) | |
tree | 5edc0a91f356a8d14e62f1cca7be9a1c20859773 /source4/lib/registry | |
parent | bc3834d6910c71159ee5e6dc3b04475706d9e846 (diff) | |
download | samba-c4a73ccd8f23eceae3ee598d9841860e7342230d.tar.gz |
s4:registry: Fix size type and loop
This fixes compilation with -Wstrict-overflow=2.
Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
Diffstat (limited to 'source4/lib/registry')
-rw-r--r-- | source4/lib/registry/tools/regshell.c | 8 |
1 files changed, 3 insertions, 5 deletions
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; |