If virNWFilterVarValueCreateSimple fails with OOM, then
'val' will be leaked by virNWFilterVarValueCreateSimpleCopyValue
Signed-off-by: Daniel P. Berrange <berrange(a)redhat.com>
---
src/conf/nwfilter_params.c | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/src/conf/nwfilter_params.c b/src/conf/nwfilter_params.c
index 40eccc4..3e85bc1 100644
--- a/src/conf/nwfilter_params.c
+++ b/src/conf/nwfilter_params.c
@@ -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 *
--
1.9.0