[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

Re: [libvirt] PATCH: Switch openvz driver to domain APIs



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


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]