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:
Jim Meyering 2010-03-29 17:43:01 +02:00
parent f8352e221f
commit 3c8877e743

View File

@ -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;