diff options
author | Karel Zak | 2011-09-12 15:35:33 +0200 |
---|---|---|
committer | Karel Zak | 2011-09-12 15:35:33 +0200 |
commit | fc8b1f36fecce949b14a452bb6e3ba9b67d362c7 (patch) | |
tree | ce09863b527c4a3345a699f10930f4046e60aa92 /lib/loopdev.c | |
parent | libmount: variable dereferenced before check [smatch scan] (diff) | |
download | kernel-qcow2-util-linux-fc8b1f36fecce949b14a452bb6e3ba9b67d362c7.tar.gz kernel-qcow2-util-linux-fc8b1f36fecce949b14a452bb6e3ba9b67d362c7.tar.xz kernel-qcow2-util-linux-fc8b1f36fecce949b14a452bb6e3ba9b67d362c7.zip |
libmount: potential null derefence [smatch scan]
Signed-off-by: Karel Zak <kzak@redhat.com>
Diffstat (limited to 'lib/loopdev.c')
-rw-r--r-- | lib/loopdev.c | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/lib/loopdev.c b/lib/loopdev.c index 81b7d2d6e..de227e226 100644 --- a/lib/loopdev.c +++ b/lib/loopdev.c @@ -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); |