diff --git a/src/security/security_dac.c b/src/security/security_dac.c index 2dbaf29ff5654f95fd7302f2a1c9a509db2e168b..5aea386e7c87578fd7238f2fdf3dcbca57c9b3e2 100644 --- a/src/security/security_dac.c +++ b/src/security/security_dac.c @@ -141,6 +141,7 @@ virSecurityDACChownListFree(void *opaque) VIR_FREE(list->items[i]); } VIR_FREE(list->items); + virObjectUnref(list->manager); VIR_FREE(list); } @@ -511,12 +512,12 @@ virSecurityDACTransactionStart(virSecurityManagerPtr mgr) if (VIR_ALLOC(list) < 0) return -1; - list->manager = mgr; + list->manager = virObjectRef(mgr); if (virThreadLocalSet(&chownList, list) < 0) { virReportSystemError(errno, "%s", _("Unable to set thread local variable")); - VIR_FREE(list); + virSecurityDACChownListFree(list); return -1; } diff --git a/src/security/security_selinux.c b/src/security/security_selinux.c index 015abc29f56dea1f4b6e836c97c015696247a112..467d1e6bfe287f92df89ca8f1ae38ba4941eef38 100644 --- a/src/security/security_selinux.c +++ b/src/security/security_selinux.c @@ -157,6 +157,7 @@ virSecuritySELinuxContextListFree(void *opaque) virSecuritySELinuxContextItemFree(list->items[i]); VIR_FREE(list->items); + virObjectUnref(list->manager); VIR_FREE(list); } @@ -1055,12 +1056,12 @@ virSecuritySELinuxTransactionStart(virSecurityManagerPtr mgr) if (VIR_ALLOC(list) < 0) return -1; - list->manager = mgr; + list->manager = virObjectRef(mgr); if (virThreadLocalSet(&contextList, list) < 0) { virReportSystemError(errno, "%s", _("Unable to set thread local variable")); - VIR_FREE(list); + virSecuritySELinuxContextListFree(list); return -1; }