[libvirt] PATCH: Switch openvz driver to domain APIs

Jim Meyering jim at meyering.net
Fri Sep 5 14:31:06 UTC 2008


"Daniel P. Berrange" <berrange at 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.




More information about the libvir-list mailing list