提交 458b952b 编写于 作者: J John Ferlan

security: Resolve possible memory leak

If virSecuritySELinuxRestoreFileLabel returns 0 or -1 too soon, then
the @newpath will be leaked.
Suggested-by: NMichal Privoznik <mprivozn@redhat.com>
Signed-off-by: NJohn Ferlan <jferlan@redhat.com>
Reviewed-by: NJán Tomko <jtomko@redhat.com>
上级 c5411773
......@@ -1477,10 +1477,12 @@ virSecuritySELinuxRestoreFileLabel(virSecurityManagerPtr mgr,
goto cleanup;
}
if ((rc = virSecuritySELinuxTransactionAppend(path, NULL, false, true)) < 0)
return -1;
else if (rc > 0)
return 0;
if ((rc = virSecuritySELinuxTransactionAppend(path, NULL, false, true)) < 0) {
goto cleanup;
} else if (rc > 0) {
ret = 0;
goto cleanup;
}
if (recall) {
if ((rc = virSecuritySELinuxRecallLabel(newpath, &fcon)) < 0) {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册