提交 3c8877e7 编写于 作者: J Jim Meyering

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.
上级 f8352e22
......@@ -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;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册