From fc8b1f36fecce949b14a452bb6e3ba9b67d362c7 Mon Sep 17 00:00:00 2001 From: Karel Zak Date: Mon, 12 Sep 2011 15:35:33 +0200 Subject: [PATCH] libmount: potential null derefence [smatch scan] Signed-off-by: Karel Zak --- lib/loopdev.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/lib/loopdev.c b/lib/loopdev.c index 81b7d2d6ec..de227e2265 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); -- 2.47.2