提交 96f4c12d 编写于 作者: J John Ferlan

util: Fix memory leak in virResctrlMonitorGetStats

Missed during review and surprisingly my run through Coverity also
didn't see this. I only noticed it when reading the code while fixing
the build breaker for commit 36780a86.

With all those continues we would leak @stats.
Signed-off-by: NJohn Ferlan <jferlan@redhat.com>
上级 36780a86
......@@ -2684,9 +2684,6 @@ virResctrlMonitorGetStats(virResctrlMonitorPtr monitor,
while (virDirRead(dirp, &ent, datapath) > 0) {
char *node_id = NULL;
if (VIR_ALLOC(stat) < 0)
goto cleanup;
/* Looking for directory that contains resource utilization
* information file. The directory name is arranged in format
* "mon_<node_name>_<node_id>". For example, "mon_L3_00" and
......@@ -2709,6 +2706,9 @@ virResctrlMonitorGetStats(virResctrlMonitorPtr monitor,
if (!(node_id = STRSKIP(node_id, "_")))
continue;
if (VIR_ALLOC(stat) < 0)
goto cleanup;
/* The node ID number should be here, parsing it. */
if (virStrToLong_uip(node_id, NULL, 0, &stat->id) < 0)
goto cleanup;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册