The virSecurityStackAddNested() can fail in which case
virSecurityManagerNewStack() should fail too.
Signed-off-by: Michal Privoznik <mprivozn(a)redhat.com>
---
src/security/security_manager.c | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/src/security/security_manager.c b/src/security/security_manager.c
index e1b571ea52..21eb6f7452 100644
--- a/src/security/security_manager.c
+++ b/src/security/security_manager.c
@@ -117,9 +117,13 @@ virSecurityManagerNewStack(virSecurityManagerPtr primary)
if (!mgr)
return NULL;
- virSecurityStackAddNested(mgr, primary);
+ if (virSecurityStackAddNested(mgr, primary) < 0)
+ goto error;
return mgr;
+ error:
+ virObjectUnref(mgr);
+ return NULL;
}
--
2.16.4