If we jump to the error: label and @secbuf is allocated, then it's not
free'd at all.
Found by Coverity
Signed-off-by: John Ferlan <jferlan(a)redhat.com>
---
tests/securityselinuxtest.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/tests/securityselinuxtest.c b/tests/securityselinuxtest.c
index f6bc07a..0ac2828 100644
--- a/tests/securityselinuxtest.c
+++ b/tests/securityselinuxtest.c
@@ -68,7 +68,7 @@ testBuildDomainDef(bool dynamic,
const char *baselabel)
{
virDomainDefPtr def;
- virSecurityLabelDefPtr secdef;
+ virSecurityLabelDefPtr secdef = NULL;
if (!(def = virDomainDefNew()))
goto error;
@@ -98,6 +98,7 @@ testBuildDomainDef(bool dynamic,
error:
virDomainDefFree(def);
+ virSecurityLabelDefFree(secdef);
return NULL;
}
--
2.9.5