On Wed, Jan 12, 2022 at 05:41:36PM +0100, Dario Faggioli wrote: > If libxl_vcpu_list() returned NULL, we should not call > libxl_numainfo_list_free() as:
You mean libxl_vcpuinfo_list_free() ? > 1) it'll fail trying to (double) free() *list This isn't really an issue. free(NULL) is legit, can be call as many time as you want. > 2) there should be nothing to free anyway The issue here is that it doesn't appear to be true. Even if "info" is NULL, "nr" have an other value than 0, so libxl_vcpuinfo_list_free() will try to access random addresses. > Signed-off-by: Dario Faggioli <[email protected]> > Tested-by: James Fehlig <[email protected]> Can I suggest to make libxl_vcpuinfo_list_free() work a bit better in case it's "nr" parameter is wrong? It will do nothing if "list" is NULL. Even if that seems wrong, and the caller should use the correct value. Also I think it is better to keep the free in the exit path at the end of the loop. Thanks, -- Anthony PERARD
