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>
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) {