[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Xen-devel] [PATCH] tools/libxl: Correct use of phyinfo_{init, dispose}()

On 05/08/15 09:40, Ian Campbell wrote:
> On Tue, 2015-08-04 at 19:58 +0100, Andrew Cooper wrote:
>> Signed-off-by: Andrew Cooper <andrew.cooper3@xxxxxxxxxx>
>> ---
>> CC: Ian Campbell <Ian.Campbell@xxxxxxxxxx>
>> CC: Ian Jackson <Ian.Jackson@xxxxxxxxxxxxx>
>> CC: Wei Liu <wei.liu2@xxxxxxxxxx>
>> For my cpuid work which I have just started, I added an array to physinfo.
>> Coverity then frowned at me when it spotted all the memory leaks.
>> Technically speaking, 4.6 isn't broken due to not having an allocation to 
>> free
>> in _dispose(), but this patch might still be worth taking in 4.6.
> We've tended to be rather lax about this for internal code when there is no
> actual work in the init/dispose functions in the current code base, so
> while this improvement is the sort of thing we should/would routinely
> except during development window I personally don't think it is worth a
> freeze exception.


> @@ -4653,6 +4654,8 @@ static int libxl__fill_dom0_memory_info(libxl__gc
>> *gc, uint32_t *target_memkb,
>>      if (rc < 0)
>>          goto out;
>> +    libxl_physinfo_dispose(&physinfo);
>> +    libxl_physinfo_init(&physinfo);
> This pattern is starting to crop up a lot in loops of this type. I wonder
> if I should make the idl generate a libxl_FOO_reinit() which just ==
> dispose+init?

Probably a good idea.  I believe I introduced the first use of that
style, finding nothing better as an alternative.


Xen-devel mailing list



Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.