mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-03-07 17:28:15 +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;
|
||||
}
|
||||
|
||||
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) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user