提交 5bb47e0c 编写于 作者: W Wang Rui 提交者: John Ferlan

lxc_container: Resolve Coverity RESOURCE_LEAK

Memory is allocated for 'mnt_src' by VIR_STRDUP in the loop. Next
loop it will be allocated again. So we need to free 'mnt_src'
before continue the loop.
Signed-off-by: NWang Rui <moon.wangrui@huawei.com>
上级 d01a062b
/*
* Copyright (C) 2008-2013 Red Hat, Inc.
* Copyright (C) 2008-2014 Red Hat, Inc.
* Copyright (C) 2008 IBM Corp.
*
* lxc_container.c: file description
......@@ -886,12 +886,14 @@ static int lxcContainerMountBasicFS(bool userns_enabled,
if (ret == 0) {
VIR_DEBUG("Skipping '%s' which isn't mounted in host",
mnt->dst);
VIR_FREE(mnt_src);
continue;
}
}
if (mnt->skipUserNS && userns_enabled) {
VIR_DEBUG("Skipping due to user ns enablement");
VIR_FREE(mnt_src);
continue;
}
......@@ -930,6 +932,8 @@ static int lxcContainerMountBasicFS(bool userns_enabled,
MS_BIND|MS_REMOUNT|MS_RDONLY);
goto cleanup;
}
VIR_FREE(mnt_src);
}
rc = 0;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册