Commit 50266dc6 by Dwight Engen Committed by Stéphane Graber

coverity 1097618: check for NULL return from calloc before deref

parent 4e03ae57
......@@ -1688,6 +1688,8 @@ char *cgroup_to_absolute_path(struct cgroup_mount_point *mp, const char *path, c
len = strlen(mp->mount_point) + strlen(path) + (suffix ? strlen(suffix) : 0);
buf = calloc(len + 1, 1);
if (!buf)
return NULL;
rv = snprintf(buf, len + 1, "%s%s%s", mp->mount_point, path, suffix ? suffix : "");
if (rv > len) {
free(buf);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment