提交 f4d7ca62 编写于 作者: M Michal Privoznik

security: Grab a reference to virSecurityManager for transactions

This shouldn't be needed per-se. Security manager shouldn't
disappear during transactions - it's immutable. However, it
doesn't hurt to grab a reference either - transaction code uses
it after all.
Signed-off-by: NMichal Privoznik <mprivozn@redhat.com>
Reviewed-by: NMarc Hartmayer <mhartmay@linux.ibm.com>
Reviewed-by: NJohn Ferlan <jferlan@redhat.com>
上级 72a8b8ec
...@@ -141,6 +141,7 @@ virSecurityDACChownListFree(void *opaque) ...@@ -141,6 +141,7 @@ virSecurityDACChownListFree(void *opaque)
VIR_FREE(list->items[i]); VIR_FREE(list->items[i]);
} }
VIR_FREE(list->items); VIR_FREE(list->items);
virObjectUnref(list->manager);
VIR_FREE(list); VIR_FREE(list);
} }
...@@ -511,12 +512,12 @@ virSecurityDACTransactionStart(virSecurityManagerPtr mgr) ...@@ -511,12 +512,12 @@ virSecurityDACTransactionStart(virSecurityManagerPtr mgr)
if (VIR_ALLOC(list) < 0) if (VIR_ALLOC(list) < 0)
return -1; return -1;
list->manager = mgr; list->manager = virObjectRef(mgr);
if (virThreadLocalSet(&chownList, list) < 0) { if (virThreadLocalSet(&chownList, list) < 0) {
virReportSystemError(errno, "%s", virReportSystemError(errno, "%s",
_("Unable to set thread local variable")); _("Unable to set thread local variable"));
VIR_FREE(list); virSecurityDACChownListFree(list);
return -1; return -1;
} }
......
...@@ -157,6 +157,7 @@ virSecuritySELinuxContextListFree(void *opaque) ...@@ -157,6 +157,7 @@ virSecuritySELinuxContextListFree(void *opaque)
virSecuritySELinuxContextItemFree(list->items[i]); virSecuritySELinuxContextItemFree(list->items[i]);
VIR_FREE(list->items); VIR_FREE(list->items);
virObjectUnref(list->manager);
VIR_FREE(list); VIR_FREE(list);
} }
...@@ -1055,12 +1056,12 @@ virSecuritySELinuxTransactionStart(virSecurityManagerPtr mgr) ...@@ -1055,12 +1056,12 @@ virSecuritySELinuxTransactionStart(virSecurityManagerPtr mgr)
if (VIR_ALLOC(list) < 0) if (VIR_ALLOC(list) < 0)
return -1; return -1;
list->manager = mgr; list->manager = virObjectRef(mgr);
if (virThreadLocalSet(&contextList, list) < 0) { if (virThreadLocalSet(&contextList, list) < 0) {
virReportSystemError(errno, "%s", virReportSystemError(errno, "%s",
_("Unable to set thread local variable")); _("Unable to set thread local variable"));
VIR_FREE(list); virSecuritySELinuxContextListFree(list);
return -1; return -1;
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册