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

virconf: Resolve a possible memory leak in virConfSetValue

Found this one by inspection... The API claims to "own" the input
value even in the case of error.  However, in the initial entry
to the API if the value exists, was STRING, but without a str value
it just returned without freeing the 'value' which it claims to now
own.  So I added the virConfFreeValue() call in order to resolve.
Signed-off-by: NJohn Ferlan <jferlan@redhat.com>
上级 a267f015
......@@ -887,8 +887,10 @@ virConfSetValue(virConfPtr conf,
{
virConfEntryPtr cur, prev = NULL;
if (value && value->type == VIR_CONF_STRING && value->str == NULL)
if (value && value->type == VIR_CONF_STRING && value->str == NULL) {
virConfFreeValue(value);
return -1;
}
cur = conf->entries;
while (cur != NULL) {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册