[CRIU] [PATCH] seccomp: don't leak info on an error path
Andrey Vagin
avagin at openvz.org
Wed Nov 25 22:13:20 PST 2015
From: Andrew Vagin <avagin at virtuozzo.com>
CID 154852 (#1 of 3): Resource leak (RESOURCE_LEAK)
32. leaked_storage: Variable info going out of scope leaks the storage it points to.
Reported-by: coverity
Signed-off-by: Andrew Vagin <avagin at virtuozzo.com>
---
seccomp.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/seccomp.c b/seccomp.c
index 50f6a70..1dd0de2 100644
--- a/seccomp.c
+++ b/seccomp.c
@@ -97,8 +97,10 @@ static int collect_filter_for_pstree(struct pstree_item *item)
info->filter.filter.len = len * sizeof(struct sock_filter);
info->filter.filter.data = xmalloc(info->filter.filter.len);
- if (!info->filter.filter.data)
+ if (!info->filter.filter.data) {
+ xfree(info);
goto out;
+ }
memcpy(info->filter.filter.data, buf, info->filter.filter.len);
--
2.4.3
More information about the CRIU
mailing list