mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2024-08-27 19:11:16 +00:00
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.
This commit is contained in:
parent
ca3bef4cec
commit
f2fb783bb6
@ -525,9 +525,12 @@ virNWFilterDetermineMissingVarsRec(virNWFilterDefPtr filter,
|
|||||||
}
|
}
|
||||||
|
|
||||||
varAccess = virBufferContentAndReset(&buf);
|
varAccess = virBufferContentAndReset(&buf);
|
||||||
virNWFilterHashTablePut(missing_vars, varAccess,
|
rc = virNWFilterHashTablePut(missing_vars, varAccess, val);
|
||||||
val);
|
|
||||||
VIR_FREE(varAccess);
|
VIR_FREE(varAccess);
|
||||||
|
if (rc < 0) {
|
||||||
|
virNWFilterVarValueFree(val);
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else if (inc) {
|
} else if (inc) {
|
||||||
|
Loading…
Reference in New Issue
Block a user