From 28dec65cc26c4b53c1e1c9077edcdb540fb29551 Mon Sep 17 00:00:00 2001 From: Andreas Schneider Date: Thu, 22 Mar 2018 10:28:02 +0100 Subject: [PATCH] s4:client: Fix size types and loop This fixes compilation with -Wstrict-overflow=2. Signed-off-by: Andreas Schneider Reviewed-by: Jeremy Allison --- source4/client/client.c | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) 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; -- 2.34.1