[PATCH 4/5] lib: avoid double free in loopdev.c

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Found with scan-build.

Signed-off-by: Sami Kerola <kerolasa@xxxxxx>
---
 lib/loopdev.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/lib/loopdev.c b/lib/loopdev.c
index 9ae61da..ca5d2f4 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;
 			}
-- 
2.8.0

--
To unsubscribe from this list: send the line "unsubscribe util-linux" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [Netdev]     [Ethernet Bridging]     [Linux Wireless]     [Kernel Newbies]     [Security]     [Linux for Hams]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux Admin]     [Samba]

  Powered by Linux