summaryrefslogtreecommitdiffstats
path: root/lib/loopdev.c
diff options
context:
space:
mode:
authorSami Kerola2016-04-03 18:43:19 +0200
committerSami Kerola2016-04-20 23:03:26 +0200
commit34f6177a24cf602d0720b82f2064e6830ba34ffb (patch)
tree36dea6660502eec1eb0b8d2a2de5e9095ff9a757 /lib/loopdev.c
parentsetpwnam: fix memory leak (diff)
downloadkernel-qcow2-util-linux-34f6177a24cf602d0720b82f2064e6830ba34ffb.tar.gz
kernel-qcow2-util-linux-34f6177a24cf602d0720b82f2064e6830ba34ffb.tar.xz
kernel-qcow2-util-linux-34f6177a24cf602d0720b82f2064e6830ba34ffb.zip
lib: avoid double free in loopdev.c
Found with scan-build. Reviewed-by: Yuriy M. Kaminskiy <yumkam@gmail.com> Signed-off-by: Sami Kerola <kerolasa@iki.fi>
Diffstat (limited to 'lib/loopdev.c')
-rw-r--r--lib/loopdev.c1
1 files changed, 1 insertions, 0 deletions
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;
}