From 83f4e8afc9a22eabb1c4cb771ffcb3af81734082 Mon Sep 17 00:00:00 2001 From: Paolo 'Blaisorblade' Giarrusso Date: Wed, 7 Mar 2007 20:41:09 -0800 Subject: [PATCH] [PATCH] um: fix a memory leak in the multicast driver Memory allocated by mcast_user_init must be freed in the matching mcast_remove. Signed-off-by: Paolo 'Blaisorblade' Giarrusso Acked-by: Jeff Dike Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- arch/um/drivers/mcast_user.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/arch/um/drivers/mcast_user.c b/arch/um/drivers/mcast_user.c index 8138f5ea1b..b827e82884 100644 --- a/arch/um/drivers/mcast_user.c +++ b/arch/um/drivers/mcast_user.c @@ -50,6 +50,14 @@ static void mcast_user_init(void *data, void *dev) pri->dev = dev; } +static void mcast_remove(void *data) +{ + struct mcast_data *pri = data; + + kfree(pri->mcast_addr); + pri->mcast_addr = NULL; +} + static int mcast_open(void *data) { struct mcast_data *pri = data; @@ -157,7 +165,7 @@ const struct net_user_info mcast_user_info = { .init = mcast_user_init, .open = mcast_open, .close = mcast_close, - .remove = NULL, + .remove = mcast_remove, .set_mtu = mcast_set_mtu, .add_address = NULL, .delete_address = NULL, -- 2.39.5