Re: [PATCH, next, v2] perf iostat: Release the port list if command allocation fails

From: Namhyung Kim

Date: Wed Nov 11 2026 - 14:15:09 EST


On Mon, 09 Nov 2026 17:01:43 +0800, lirongqing wrote:
> iostat_event_group() takes ownership of the root port list and frees it
> via the err: label on both the normal and parsing-error paths. When
> calloc() for iostat_cmd fails, however, the function returns -ENOMEM
> directly, leaking the list, its pointer array and every port in it.
>
> Route this failure through the existing cleanup path instead. At this
> point no port has been transferred to an event yet, so
> iio_root_ports_list_free() releases the whole list, and the trailing
> free(iostat_cmd) is a no-op on the NULL pointer.
>
> [...]

Applied to perf-tools-next, thanks!

Best regards
Namhyung