From: Sami Kerola Date: Sun, 3 Apr 2016 16:43:19 +0000 (+0100) Subject: lib: avoid double free in loopdev.c X-Git-Tag: v2.28.1~45 X-Git-Url: http://git.ipfire.org/gitweb/gitweb.cgi?a=commitdiff_plain;h=b6384d233e300d42d5d39a39ff2c51f3419de639;p=thirdparty%2Futil-linux.git lib: avoid double free in loopdev.c Found with scan-build. Reviewed-by: Yuriy M. Kaminskiy Signed-off-by: Sami Kerola --- diff --git a/lib/loopdev.c b/lib/loopdev.c index 9ae61daa95..26c183e8d6 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; }