mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-03-20 07:59:00 +00:00
security: Resolve possible memory leak
If virSecuritySELinuxRestoreFileLabel returns 0 or -1 too soon, then the @newpath will be leaked. Suggested-by: Michal Privoznik <mprivozn@redhat.com> Signed-off-by: John Ferlan <jferlan@redhat.com> Reviewed-by: Ján Tomko <jtomko@redhat.com>
This commit is contained in:
parent
c541177314
commit
458b952bee
@ -1477,10 +1477,12 @@ virSecuritySELinuxRestoreFileLabel(virSecurityManagerPtr mgr,
|
|||||||
goto cleanup;
|
goto cleanup;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((rc = virSecuritySELinuxTransactionAppend(path, NULL, false, true)) < 0)
|
if ((rc = virSecuritySELinuxTransactionAppend(path, NULL, false, true)) < 0) {
|
||||||
return -1;
|
goto cleanup;
|
||||||
else if (rc > 0)
|
} else if (rc > 0) {
|
||||||
return 0;
|
ret = 0;
|
||||||
|
goto cleanup;
|
||||||
|
}
|
||||||
|
|
||||||
if (recall) {
|
if (recall) {
|
||||||
if ((rc = virSecuritySELinuxRecallLabel(newpath, &fcon)) < 0) {
|
if ((rc = virSecuritySELinuxRecallLabel(newpath, &fcon)) < 0) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user