]> Sergey Matveev's repositories - nnn.git/commitdiff
Initialize `n' and `dents'
authorsin <sin@2f30.org>
Wed, 22 Oct 2014 15:33:59 +0000 (16:33 +0100)
committersin <sin@2f30.org>
Wed, 22 Oct 2014 15:34:16 +0000 (16:34 +0100)
noice.c

diff --git a/noice.c b/noice.c
index a2599d7ea62412a485820ba3d90207daafd2b6e8..48ee105760fe6dd2a13ef7960ab54d906e249a47 100644 (file)
--- a/noice.c
+++ b/noice.c
@@ -497,6 +497,10 @@ browse(const char *ipath, const char *ifilter)
 
        cur = 0;
 begin:
+       /* Path and filter should be malloc(3)-ed strings at all times */
+       n = 0;
+       dents = NULL;
+
        dirp = opendir(path);
        if (dirp == NULL) {
                printwarn();
@@ -511,7 +515,6 @@ begin:
        if (r != 0)
                goto nochange;
 
-       dents = NULL;
        n = dentfill(dirp, &dents, visible, &filter_re);
 
        /* Make sure cur is in range */