realtek: fix memory leak in netevent handler
authorJan Hoffmann <jan@3e8.eu>
Wed, 8 Feb 2023 21:53:32 +0000 (22:53 +0100)
committerSander Vanheule <sander@svanheule.net>
Mon, 13 Feb 2023 11:14:16 +0000 (12:14 +0100)
commit65b2bcbf5f0037f24e3772b2c96de03230fdaaf7
tree2f5ab120e1490dd2d1e964396bb70967471d4951
parent1352e5da8dd722be9fdb3c8f5d616a553d529831
realtek: fix memory leak in netevent handler

The net_event_work struct is allocated, but only freed in a single case.
Move the allocation to the branch where it is actually needed, and free
it after the work has been done.

Fixes: 03e1d93e0779 ("realtek: add driver support for routing offload")
Signed-off-by: Jan Hoffmann <jan@3e8.eu>
target/linux/realtek/files-5.10/drivers/net/dsa/rtl83xx/common.c
target/linux/realtek/files-5.15/drivers/net/dsa/rtl83xx/common.c