Fix possible crash in handling IO Error event

If the IO error event does not include a reason, then there
is a possible crash dispatching the event

* src/conf/domain_event.c: Missing check for a NULL reason before
  strduping allows for a crash
This commit is contained in:
Daniel P. Berrange 2010-05-11 10:34:38 -04:00
parent ff45b4c26f
commit abb7694211

View File

@ -671,7 +671,7 @@ static virDomainEventPtr virDomainEventIOErrorNewFromObjImpl(int event,
ev->data.ioError.action = action;
if (!(ev->data.ioError.srcPath = strdup(srcPath)) ||
!(ev->data.ioError.devAlias = strdup(devAlias)) ||
!(ev->data.ioError.reason = strdup(reason))) {
(reason && !(ev->data.ioError.reason = strdup(reason)))) {
virDomainEventFree(ev);
ev = NULL;
}