mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-01-11 15:27:47 +00:00
fix memory leak in qemuProcessHandleGraphics()
If strdup("x509dname") or strdup("saslUsername") success, but strdup(x509dname) or strdup(saslUsername) failed, subject->nidentity is not the num elements of subject->identities, and we will leak some memory.
This commit is contained in:
parent
19f916a764
commit
4a3976211d
@ -544,18 +544,18 @@ qemuProcessHandleGraphics(qemuMonitorPtr mon ATTRIBUTE_UNUSED,
|
|||||||
if (x509dname) {
|
if (x509dname) {
|
||||||
if (VIR_REALLOC_N(subject->identities, subject->nidentity+1) < 0)
|
if (VIR_REALLOC_N(subject->identities, subject->nidentity+1) < 0)
|
||||||
goto no_memory;
|
goto no_memory;
|
||||||
if (!(subject->identities[subject->nidentity].type = strdup("x509dname")) ||
|
|
||||||
!(subject->identities[subject->nidentity].name = strdup(x509dname)))
|
|
||||||
goto no_memory;
|
|
||||||
subject->nidentity++;
|
subject->nidentity++;
|
||||||
|
if (!(subject->identities[subject->nidentity-1].type = strdup("x509dname")) ||
|
||||||
|
!(subject->identities[subject->nidentity-1].name = strdup(x509dname)))
|
||||||
|
goto no_memory;
|
||||||
}
|
}
|
||||||
if (saslUsername) {
|
if (saslUsername) {
|
||||||
if (VIR_REALLOC_N(subject->identities, subject->nidentity+1) < 0)
|
if (VIR_REALLOC_N(subject->identities, subject->nidentity+1) < 0)
|
||||||
goto no_memory;
|
goto no_memory;
|
||||||
if (!(subject->identities[subject->nidentity].type = strdup("saslUsername")) ||
|
|
||||||
!(subject->identities[subject->nidentity].name = strdup(saslUsername)))
|
|
||||||
goto no_memory;
|
|
||||||
subject->nidentity++;
|
subject->nidentity++;
|
||||||
|
if (!(subject->identities[subject->nidentity-1].type = strdup("saslUsername")) ||
|
||||||
|
!(subject->identities[subject->nidentity-1].name = strdup(saslUsername)))
|
||||||
|
goto no_memory;
|
||||||
}
|
}
|
||||||
|
|
||||||
virDomainObjLock(vm);
|
virDomainObjLock(vm);
|
||||||
|
Loading…
Reference in New Issue
Block a user