On Fri, Sep 05, 2008 at 04:31:06PM +0200, Jim Meyering wrote:
> "Daniel P. Berrange" <[EMAIL PROTECTED]> 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.
Oh, you meant the first pointer deference, not the second
Daniel
--
|: Red Hat, Engineering, London -o- http://people.redhat.com/berrange/ :|
|: http://libvirt.org -o- http://virt-manager.org -o- http://ovirt.org :|
|: http://autobuild.org -o- http://search.cpan.org/~danberr/ :|
|: GnuPG: 7D3B9505 -o- F3C9 553F A1DA 4AC2 5648 23C1 B3DF F742 7D3B 9505 :|
--
Libvir-list mailing list
[email protected]
https://www.redhat.com/mailman/listinfo/libvir-list