From 549ac3d142f004cd265849f176aafce848a6b922 Mon Sep 17 00:00:00 2001 From: Michal Privoznik Date: Tue, 21 Aug 2018 14:54:52 +0200 Subject: [PATCH] virSecurityManagerNewStack: Don't ignore virSecurityStackAddNested retval The virSecurityStackAddNested() can fail in which case virSecurityManagerNewStack() should fail too. Signed-off-by: Michal Privoznik Reviewed-by: John Ferlan --- 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; } -- GitLab