summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndreas Schneider <asn@samba.org>2018-03-22 10:28:02 +0100
committerJeremy Allison <jra@samba.org>2018-04-03 20:20:10 +0200
commit28dec65cc26c4b53c1e1c9077edcdb540fb29551 (patch)
tree3f214dc0b62e9b8bed3f9758adf25041d33a7998
parentc4a73ccd8f23eceae3ee598d9841860e7342230d (diff)
downloadsamba-28dec65cc26c4b53c1e1c9077edcdb540fb29551.tar.gz
s4:client: Fix size types and loop
This fixes compilation with -Wstrict-overflow=2. Signed-off-by: Andreas Schneider <asn@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org>
-rw-r--r--source4/client/client.c8
1 files changed, 3 insertions, 5 deletions
diff --git a/source4/client/client.c b/source4/client/client.c
index f73d9f99d20..284511fb58a 100644
--- a/source4/client/client.c
+++ b/source4/client/client.c
@@ -3053,7 +3053,7 @@ static char **completion_fn(const char *text, int start, int end)
return NULL;
} else {
char **matches;
- int i, len, samelen = 0, count=1;
+ size_t i, len, samelen = 0, count=1;
matches = malloc_array_p(char *, MAX_COMPLETIONS);
if (!matches) return NULL;
@@ -3092,10 +3092,8 @@ static char **completion_fn(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;