mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2024-12-23 06:05:27 +00:00
Fix memory leak on OOM in virSecuritySELinuxMCSFind
The body of the loop in virSecuritySELinuxMCSFind would directly 'return NULL' on OOM, instead of jumping to the cleanup label. This caused a leak of several local vars. Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
This commit is contained in:
parent
2f98a7f7ba
commit
f2d8190cfb
@ -214,7 +214,7 @@ virSecuritySELinuxMCSFind(virSecurityManagerPtr mgr)
|
||||
if (c1 == c2) {
|
||||
if (virAsprintf(&mcs, "%s:c%d", sens, catMin + c1) < 0) {
|
||||
virReportOOMError();
|
||||
return NULL;
|
||||
goto cleanup;
|
||||
}
|
||||
} else {
|
||||
if (c1 > c2) {
|
||||
@ -224,7 +224,7 @@ virSecuritySELinuxMCSFind(virSecurityManagerPtr mgr)
|
||||
}
|
||||
if (virAsprintf(&mcs, "%s:c%d,c%d", sens, catMin + c1, catMin + c2) < 0) {
|
||||
virReportOOMError();
|
||||
return NULL;
|
||||
goto cleanup;
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user