mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2024-12-28 11:21:44 +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: 2e668a61d5
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…
Reference in New Issue
Block a user