"Daniel P. Berrange" <berrange(a)redhat.com> wrote:
> > static int openvzDomainShutdown(virDomainPtr dom) {
> > struct openvz_driver *driver = (struct openvz_driver
*)dom->conn->privateData;
> > - struct openvz_vm *vm = openvzFindVMByUUID(driver, dom->uuid);
> > - const char *prog[] = {VZCTL, "--quiet", "stop",
vm->vmdef->name, NULL};
> > + virDomainObjPtr vm = virDomainFindByUUID(driver->domains,
dom->uuid);
> > + const char *prog[] = {VZCTL, "--quiet", "stop",
vm->def->name, NULL};
>
> I know it's nothing new, but the above use of "vm" can dereference
NULL.
Every 'virDomainPtr' object is /required/ to have a non-NULL 'def'
field.
Only the 'newDef' field is alllowed to be NULL.
Yes, but "vm" itself will be NULL if virDomainFindByUUID fails.