]> git.ipfire.org Git - thirdparty/util-linux.git/commitdiff
libmount: potential null derefence [smatch scan]
authorKarel Zak <kzak@redhat.com>
Mon, 12 Sep 2011 13:35:33 +0000 (15:35 +0200)
committerKarel Zak <kzak@redhat.com>
Mon, 12 Sep 2011 13:35:33 +0000 (15:35 +0200)
Signed-off-by: Karel Zak <kzak@redhat.com>
lib/loopdev.c

index 81b7d2d6ec7cf38efa29ea3caee412712bd9857e..de227e2265e15f4d164d08cbccb41134cea00bc9 100644 (file)
@@ -369,9 +369,10 @@ static int loop_scandir(const char *dirname, int **ary, int hasprefix)
                        }
                        *ary = tmp;
                }
-               (*ary)[count++] = n;
+               if (*ary)
+                       (*ary)[count++] = n;
        }
-       if (count)
+       if (count && *ary)
                qsort(*ary, count, sizeof(int), cmpnum);
 
        closedir(dir);