[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

[libvirt] [PATCH v3 02/28] virSecurityManagerNewStack: Don't ignore virSecurityStackAddNested retval



The virSecurityStackAddNested() can fail in which case
virSecurityManagerNewStack() should fail too.

Signed-off-by: Michal Privoznik <mprivozn 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


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]