From: Andreas Schneider Date: Thu, 22 Mar 2018 09:28:02 +0000 (+0100) Subject: s4:client: Fix size types and loop X-Git-Url: http://git.samba.org/?p=metze%2Fsamba%2Fwip.git;a=commitdiff_plain;h=28dec65cc26c4b53c1e1c9077edcdb540fb29551 s4:client: Fix size types and loop This fixes compilation with -Wstrict-overflow=2. Signed-off-by: Andreas Schneider Reviewed-by: Jeremy Allison --- diff --git a/source4/client/client.c b/source4/client/client.c index f73d9f99d208..284511fb58a8 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;