Introduced by commit id 'c3d9d3bb' - return from virSecurityManagerCheckModel
wasn't VIR_FREE()'ing the virSecurityManagerGetNested allocated memory.
Signed-off-by: John Ferlan <jferlan(a)redhat.com>
---
src/security/security_manager.c | 17 ++++++++++++-----
1 file changed, 12 insertions(+), 5 deletions(-)
diff --git a/src/security/security_manager.c b/src/security/security_manager.c
index f2a32bc..12663ad 100644
--- a/src/security/security_manager.c
+++ b/src/security/security_manager.c
@@ -688,24 +688,31 @@ virSecurityManagerReleaseLabel(virSecurityManagerPtr mgr,
static int virSecurityManagerCheckModel(virSecurityManagerPtr mgr,
char *secmodel)
{
+ int ret = -1;
size_t i;
virSecurityManagerPtr *sec_managers = NULL;
if ((sec_managers = virSecurityManagerGetNested(mgr)) == NULL)
return -1;
- if (STREQ_NULLABLE(secmodel, "none"))
- return 0;
+ if (STREQ_NULLABLE(secmodel, "none")) {
+ ret = 0;
+ goto cleanup;
+ }
for (i = 0; sec_managers[i]; i++) {
- if (STREQ_NULLABLE(secmodel, sec_managers[i]->drv->name))
- return 0;
+ if (STREQ_NULLABLE(secmodel, sec_managers[i]->drv->name)) {
+ ret = 0;
+ goto cleanup;
+ }
}
virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
_("Unable to find security driver for model %s"),
secmodel);
- return -1;
+ cleanup:
+ VIR_FREE(sec_managers);
+ return ret;
}
--
2.1.0