On Thu, Mar 19, 2020 at 04:12:10PM +0100, Tim Duesterhus wrote: > William, > > I hope I correctly understood the purpose of that `+ 1` there. The issue was > found using a static analyzer that complained that `fcount` could be zero, > leading to a 0 byte allocation. If this fix is incorrect then the function > must be adjusted to check for `fcount == 0` and do something sane. > > Best regards > Tim Düsterhus > > Apply with `git am --scissors` to automatically cut the commit message. >
Well, it's a double mistake, it should also be put to NULL when fcount is 0. This mistake was returning a NULL ptr with fcount == 0 because of calloc, but with your patch that won't be the case anymore. It will probably works since we don't do much thing when fcount is 0 but we better be consistent. I'm merging your patch and making another one for this. Thanks Tim! -- William Lallemand