Re: [libvirt] [PATCH] Fix closedir usage in virNumaGetPages

2014-06-23 Thread Ján Tomko
On 06/21/2014 05:29 PM, Roman Bogorodskiy wrote: virNumaGetPages calls closedir(dir) in cleanup and dir could be NULL if we jump there from the failed opendir() call. While it's not harmful on Linux, FreeBSD libc crashes [1], so make sure that dir is not NULL before calling closedir. 1:

Re: [libvirt] [PATCH] Fix closedir usage in virNumaGetPages

2014-06-23 Thread Michal Privoznik
On 21.06.2014 17:29, Roman Bogorodskiy wrote: virNumaGetPages calls closedir(dir) in cleanup and dir could be NULL if we jump there from the failed opendir() call. While it's not harmful on Linux, FreeBSD libc crashes [1], so make sure that dir is not NULL before calling closedir. 1:

Re: [libvirt] [PATCH] Fix closedir usage in virNumaGetPages

2014-06-23 Thread Eric Blake
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

Re: [libvirt] [PATCH] Fix closedir usage in virNumaGetPages

2014-06-23 Thread Roman Bogorodskiy
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

[libvirt] [PATCH] Fix closedir usage in virNumaGetPages

2014-06-21 Thread Roman Bogorodskiy
virNumaGetPages calls closedir(dir) in cleanup and dir could be NULL if we jump there from the failed opendir() call. While it's not harmful on Linux, FreeBSD libc crashes [1], so make sure that dir is not NULL before calling closedir. 1:

Re: [libvirt] [PATCH] Fix closedir usage in virNumaGetPages

2014-06-21 Thread Nehal J Wani
On Sat, Jun 21, 2014 at 8:59 PM, Roman Bogorodskiy bogorods...@gmail.com wrote: virNumaGetPages calls closedir(dir) in cleanup and dir could be NULL if we jump there from the failed opendir() call. While it's not harmful on Linux, FreeBSD libc crashes [1], so make sure that dir is not NULL