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

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

 



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

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

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list



[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]

  Powered by Linux