Eric Blake wrote:

> On 06/23/2014 05:46 AM, Michal Privoznik wrote:
> 
> >> -    closedir(dir);
> >> +    if (dir)
> >> +        closedir(dir);
> >>       VIR_FREE(path);
> >>       return ret;
> >>   }
> >>
> > 
> > So why is free(NULL) safe on FreeBSD then? I'd call this a libc bug not
> > a libvirt one. But since even we already have such borken design
> > (remember our publir vir*Free() APIs?) I can live with this patch.
> 
> free(NULL) is explicitly required by C (and therefore POSIX) to be safe.
>  closedir(NULL) is intentionally unspecified by POSIX, and therefore
> unsafe.  It would be nice if the two had similar requirements, but as
> POSIX was merely standardizing existing practice, we are stuck with them
> being different in behavior.

The patch is pushed now; thanks.

Roman Bogorodskiy

Attachment: pgpJaW8oVBxxu.pgp
Description: PGP signature

--
libvir-list mailing list
[email protected]
https://www.redhat.com/mailman/listinfo/libvir-list

Reply via email to