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

source/client/client.c

index a10d425..1fdbec4 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;