Files
Peter Maydell a0721c099b hw/net/rocker: Avoid double-free of l2_flood.group_ids
In of_dpa_cmd_add_l2_flood(), we allocate memory for the
group->l2_flood.group_ids array, freeing any previous array.
However, in the error-exit path we free the group_ids memory but do
not clear the pointer to NULL.  This means that if the guest causes
us to take the error-exit path and then later call the function
again, we will try again to free the memory we already freed.

Fix this by clearing the group_ids pointer in the error exit
path, so we maintain the invariant of "either it points at
allocated memory, or it is NULL" (both being valid to g_free()).

Cc: qemu-stable@nongnu.org
Fixes: dc488f8880 ("rocker: add new rocker switch device")
Resolves: https://gitlab.com/qemu-project/qemu/-/work_items/3253
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Message-id: 20260324193530.375628-1-peter.maydell@linaro.org
2026-03-30 16:18:06 +01:00
..
2023-03-10 15:35:38 +08:00
2023-09-20 07:54:34 +03:00
2024-03-12 19:28:32 +08:00
2023-11-13 15:33:37 +08:00
2024-03-12 19:28:31 +08:00
2026-03-06 09:01:11 +00:00
2026-03-08 23:08:41 +01:00
2025-12-27 10:11:06 +01:00
2023-05-23 15:20:15 +08:00
2025-12-27 10:11:06 +01:00