提交 009fce98 编写于 作者: E Eric Blake

security: avoid memory leak

Leak introduced in commit d6623003.

* src/qemu/qemu_driver.c (qemuSecurityInit): Avoid leak on failure.
* src/security/security_stack.c (virSecurityStackClose): Avoid
leaking component drivers.
上级 dfd39ccd
......@@ -204,8 +204,11 @@ qemuSecurityInit(struct qemud_driver *driver)
goto error;
if (!(driver->securityManager = virSecurityManagerNewStack(mgr,
dac)))
dac))) {
virSecurityManagerFree(dac);
goto error;
}
} else {
driver->securityManager = mgr;
}
......
......@@ -61,8 +61,13 @@ virSecurityStackOpen(virSecurityManagerPtr mgr ATTRIBUTE_UNUSED)
}
static int
virSecurityStackClose(virSecurityManagerPtr mgr ATTRIBUTE_UNUSED)
virSecurityStackClose(virSecurityManagerPtr mgr)
{
virSecurityStackDataPtr priv = virSecurityManagerGetPrivateData(mgr);
virSecurityManagerFree(priv->primary);
virSecurityManagerFree(priv->secondary);
return 0;
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册