r24698: Patch from Andrew Kroeger <andrew@sprocks.gotdns.com> to fix Bug
authorAndrew Bartlett <abartlet@samba.org>
Mon, 27 Aug 2007 10:16:54 +0000 (10:16 +0000)
committerGerald (Jerry) Carter <jerry@samba.org>
Wed, 10 Oct 2007 20:02:49 +0000 (15:02 -0500)
#4521: smbclient crashes during tab completion when tab hit twice.

The readline magic is beyond me, but this seems to do the trick.

Andrew Bartlett
(This used to be commit e05f3450ecc3f99509fbc069b09d402e3b6d7564)

source4/client/client.c

index a10d4254a3a4a5e5d6a15fb64f9583d57ca2e496..1fdbec4bfd010f5f90f1bb3e84e30e5a86f9d55b 100644 (file)
@@ -2922,9 +2922,10 @@ static char **completion_fn(const char *text, int start, int end)
                return matches;
 
 cleanup:
-               while (i >= 0) {
-                       free(matches[i]);
-                       i--;
+               count--;
+               while (count >= 0) {
+                       free(matches[count]);
+                       count--;
                }
                free(matches);
                return NULL;