1
0
mirror of https://gitlab.com/libvirt/libvirt.git synced 2024-12-25 01:34:11 +03:00

Fix leak on OOM in virNWFilterVarValueCreateSimpleCopyValue

If virNWFilterVarValueCreateSimple fails with OOM, then
'val' will be leaked by virNWFilterVarValueCreateSimpleCopyValue

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
This commit is contained in:
Daniel P. Berrange 2014-04-08 15:43:45 +01:00
parent dff3ad004a
commit 9b095625e4

View File

@ -126,10 +126,14 @@ virNWFilterVarValuePtr
virNWFilterVarValueCreateSimpleCopyValue(const char *value)
{
char *val;
virNWFilterVarValuePtr ret;
if (VIR_STRDUP(val, value) < 0)
return NULL;
return virNWFilterVarValueCreateSimple(val);
ret = virNWFilterVarValueCreateSimple(val);
if (!ret)
VIR_FREE(val);
return ret;
}
const char *