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

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

 



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

--
Libvir-list mailing list
Libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list

[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]