提交 b54f4881 编写于 作者: J Ján Tomko

Fix a memory leak in virCgroupGetPercpuStats

Coverity reports that my commit af1c98e4 introduced
two memory leaks:
the cpumap if ncpus == 0 in virCgroupGetPercpuStats
and the params array in the test of the function.
上级 495accb0
......@@ -3061,8 +3061,10 @@ virCgroupGetPercpuStats(virCgroupPtr group,
total_cpus = virBitmapSize(cpumap);
if (ncpus == 0)
return total_cpus;
if (ncpus == 0) {
rv = total_cpus;
goto cleanup;
}
if (start_cpu >= total_cpus) {
virReportError(VIR_ERR_INVALID_ARG,
......
......@@ -614,6 +614,7 @@ static int testCgroupGetPercpuStats(const void *args ATTRIBUTE_UNUSED)
cleanup:
virCgroupFree(&cgroup);
VIR_FREE(params);
return ret;
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册