]> git.wh0rd.org Git - nano.git/commitdiff
- files.c:input_tab() - Fix assumption that matches is null terminated (David Benbennick)
authorChris Allegretta <chrisa@asty.org>
Sat, 8 Feb 2003 02:02:02 +0000 (02:02 +0000)
committerChris Allegretta <chrisa@asty.org>
Sat, 8 Feb 2003 02:02:02 +0000 (02:02 +0000)
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@1431 35c25a1d-7b9e-4130-9fde-d3aeb78583b8

ChangeLog
files.c

index f5d94187d84ef43f2b78740431858eef05434fc6..af47f8f82eaed9e5da7a0ef1fa37fd0a4305d2fc 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -3,6 +3,10 @@ CVS code
        - Translation updates (see po/ChangeLog for details).
        - Fix globals and externs such that nano will compile with
          DISABLE_SPELLER (David Benbennick).
+- files.c:
+  intput_tab()
+       - Fix assumption that matches is null terminated (David 
+         Benbennick).
 - nano.c:
   main()
        - Fix nano not compiling with ENABLE_RCFILE and DISABLE_TABCOMP
diff --git a/files.c b/files.c
index 6580db66d2cf16ba7cb2acfcaacc49c87fcb26fe..2dfa1b60f45cc30db99f120ee653b6f53b3c9cf3 100644 (file)
--- a/files.c
+++ b/files.c
@@ -2116,6 +2116,8 @@ char **cwd_tab_completion(char *buf, int *num_matches)
                break;
        }
     }
+    closedir(dir);
+    free(dirname);
 
     return matches;
 }
@@ -2312,7 +2314,7 @@ char *input_tab(char *buf, int place, int *lastwastab, int *newplace, int *list)
 
                /* And if the next match isn't going to fit on the
                   line, move to the next one */
-               if (col > (COLS - longestname) && matches[i + 1] != NULL) {
+               if (col > COLS - longestname && i + 1 < num_matches) {
                    editline++;
                    wmove(edit, editline, 0);
                    if (editline == editwinrows - 1) {