From 34f6177a24cf602d0720b82f2064e6830ba34ffb Mon Sep 17 00:00:00 2001 From: Sami Kerola Date: Sun, 3 Apr 2016 17:43:19 +0100 Subject: [PATCH] lib: avoid double free in loopdev.c Found with scan-build. Reviewed-by: Yuriy M. Kaminskiy Signed-off-by: Sami Kerola --- lib/loopdev.c | 1 + 1 file changed, 1 insertion(+) diff --git a/lib/loopdev.c b/lib/loopdev.c index 9ae61daa9..26c183e8d 100644 --- a/lib/loopdev.c +++ b/lib/loopdev.c @@ -460,6 +460,7 @@ static int loop_scandir(const char *dirname, int **ary, int hasprefix) tmp = realloc(*ary, arylen * sizeof(int)); if (!tmp) { free(*ary); + *ary = NULL; closedir(dir); return -1; }