[CRIU] [PATCH] cg: props -- Fix resource leak on realloc failure
Cyrill Gorcunov
gorcunov at openvz.org
Tue May 17 00:09:15 PDT 2016
| *** CID 161426: Resource leaks (RESOURCE_LEAK)
| /criu/cgroup-props.c: 318 in cgp_parse_stream()
| 312 }
| 313
| 314 if (xrealloc_safe(&cgp_entry->cgp.props,
| 315 (cgp_entry->cgp.nr_props + 1) * sizeof(char *))) {
| 316 pr_err("Can't allocate property for controller %s\n",
| 317 cgp_entry->cgp.name);
| >>> CID 161426: Resource leaks (RESOURCE_LEAK)
| >>> Variable "cgp_entry" going out of scope leaks the storage it points to.
| 318 return -1;
| 319 }
Signed-off-by: Cyrill Gorcunov <gorcunov at openvz.org>
---
criu/cgroup-props.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/criu/cgroup-props.c b/criu/cgroup-props.c
index 5328efc22d3e..0111ee50f931 100644
--- a/criu/cgroup-props.c
+++ b/criu/cgroup-props.c
@@ -315,7 +315,7 @@ static int cgp_parse_stream(char *stream, size_t len)
(cgp_entry->cgp.nr_props + 1) * sizeof(char *))) {
pr_err("Can't allocate property for controller %s\n",
cgp_entry->cgp.name);
- return -1;
+ goto err_parse;
}
cgp_entry->cgp.props[cgp_entry->cgp.nr_props++] = p;
--
2.5.5
More information about the CRIU
mailing list