mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-02-10 17:57:25 +03:00
security: fix use-after-free in virSecuritySELinuxReserveLabel
commit 2e668a61d5ae4("Fix error handling when adding MCS labels") uses the 'pctx' in virReportError after it has been freed. Fix it. Fixes: 2e668a61d5ae4cbd6f79e096d0c394f186e132bd Signed-off-by: Zhenyu Ye <yezhenyu2@huawei.com> Reviewed-by: Martin Kletzander <mkletzan@redhat.com>
This commit is contained in:
parent
32f7db0989
commit
f14d6ab537
@ -967,7 +967,6 @@ virSecuritySELinuxReserveLabel(virSecurityManager *mgr,
|
||||
}
|
||||
|
||||
ctx = context_new(pctx);
|
||||
freecon(pctx);
|
||||
if (!ctx)
|
||||
goto error;
|
||||
|
||||
@ -985,11 +984,13 @@ virSecuritySELinuxReserveLabel(virSecurityManager *mgr,
|
||||
goto error;
|
||||
}
|
||||
|
||||
freecon(pctx);
|
||||
context_free(ctx);
|
||||
|
||||
return 0;
|
||||
|
||||
error:
|
||||
freecon(pctx);
|
||||
context_free(ctx);
|
||||
return -1;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user