Passing NULL in the place of the cgroup name as an argument to
cgroup_new_cgroup() API will segfault, fix by adding a check to validate
cgroup name.
Signed-off-by: Kamalesh Babulal <kamalesh.babulal@oracle.com>
Signed-off-by: Tom Hromatka <tom.hromatka@oracle.com>
(cherry picked from commit
a8973c694a83229ef74e96e44a740dceabff1db3)
struct cgroup *cgroup_new_cgroup(const char *name)
{
- struct cgroup *cgroup = calloc(1, sizeof(struct cgroup));
+ struct cgroup *cgroup;
+ if (!name)
+ return NULL;
+
+ cgroup = calloc(1, sizeof(struct cgroup));
if (!cgroup)
return NULL;