On 5/10/19 10:08 AM, Peter Krempa wrote:
On Fri, May 10, 2019 at 09:52:27 +0200, Michal Privoznik wrote:
> If no board was detected then VIR_REALLOC_N() done at the end of
> the function will actually free the memory (because nborads ==
> 0), but @boards will be set to a non-NULL pointer. This makes it
> unnecessary harder for a caller to see if any board was detected.
Ah, yeah. Allocating 0 bytes of memory may get you a pointer.
I'm wondering if it makes sense to modify VIR_REALLOC_N() so that it
calls VIR_FREE() if count == 0. If so, then this patch is not needed.
Michal