Skip to content

Commit

Permalink
seccomp: don't leak info on an error path
Browse files Browse the repository at this point in the history
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@virtuozzo.com>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
  • Loading branch information
avagin authored and xemul committed Nov 30, 2015
1 parent 1bd799e commit d55e13d
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion seccomp.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand Down

0 comments on commit d55e13d

Please sign in to comment.