提交 f2fb783b 编写于 作者: J John Ferlan

nwfilter: Fix memory leak and error path

Found by Coverity. If virNWFilterHashTablePut, then the 3rd arg @val
must be free'd since it would be leaked.

This also fixes potential problem on the error path where the caller
could assume the virNWFilterHashTablePut was successful when in fact
it failed leading to other issues.
上级 ca3bef4c
......@@ -525,9 +525,12 @@ virNWFilterDetermineMissingVarsRec(virNWFilterDefPtr filter,
}
varAccess = virBufferContentAndReset(&buf);
virNWFilterHashTablePut(missing_vars, varAccess,
val);
rc = virNWFilterHashTablePut(missing_vars, varAccess, val);
VIR_FREE(varAccess);
if (rc < 0) {
virNWFilterVarValueFree(val);
return -1;
}
}
}
} else if (inc) {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册