mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-01-11 15:27:47 +00:00
domain_event.c: don't deref NULL on an OOM error path
* src/conf/domain_event.c (virDomainEventGraphicsNewFromDom): Return NULL when handling out-of-memory error, rather than falling through with ev=NULL and then assigning to ev->member. (virDomainEventGraphicsNewFromObj): Likewise.
This commit is contained in:
parent
f8352e221f
commit
3c8877e743
@ -687,7 +687,7 @@ virDomainEventPtr virDomainEventGraphicsNewFromDom(virDomainPtr dom,
|
||||
ev->data.graphics.phase = phase;
|
||||
if (!(ev->data.graphics.authScheme = strdup(authScheme))) {
|
||||
virDomainEventFree(ev);
|
||||
ev = NULL;
|
||||
return NULL;
|
||||
}
|
||||
ev->data.graphics.local = local;
|
||||
ev->data.graphics.remote = remote;
|
||||
@ -712,7 +712,7 @@ virDomainEventPtr virDomainEventGraphicsNewFromObj(virDomainObjPtr obj,
|
||||
ev->data.graphics.phase = phase;
|
||||
if (!(ev->data.graphics.authScheme = strdup(authScheme))) {
|
||||
virDomainEventFree(ev);
|
||||
ev = NULL;
|
||||
return NULL;
|
||||
}
|
||||
ev->data.graphics.local = local;
|
||||
ev->data.graphics.remote = remote;
|
||||
|
Loading…
Reference in New Issue
Block a user