On 04/05/2011 10:55 AM, Jesse J Cook wrote: >>> + if ('/' != *(vol->backingStore.path)) { >>> + virAsprintf(&absolutePath, "%s/%s", pool->def->target.path, >>> + vol->backingStore.path); >>> + >>> + } else { >>> + virAsprintf(&absolutePath, "%s", vol->backingStore.path); >> >> strdup is more efficient here, and avoiding malloc in the first place >> even more so. >> >>> + } >>> + accessRetCode = access(absolutePath, R_OK); >> >> This could segfault on OOM. >> >>> + VIR_FREE(absolutePath); > > I believe there needs to be a NULL check here or absolute paths and > virAsprintf errors will segfault. I can patch if you don't beat me to > it. How so? absolutePath was initialized as NULL; is only ever set to non-null by a successful virAsprintf, and VIR_FREE works correctly (no-op) on a NULL argument. Put another way, are you missing that VIR_FREE already has an embedded NULL check? -- Eric Blake eblake@xxxxxxxxxx +1-801-349-2682 Libvirt virtualization library http://libvirt.org
Attachment:
signature.asc
Description: OpenPGP digital signature
-- libvir-list mailing list libvir-list@xxxxxxxxxx https://www.redhat.com/mailman/listinfo/libvir-list