Skip to content

Commit

Permalink
[PATCH] um: fix a memory leak in the multicast driver
Browse files Browse the repository at this point in the history
Memory allocated by mcast_user_init must be freed in the matching mcast_remove.

Signed-off-by: Paolo 'Blaisorblade' Giarrusso <blaisorblade@yahoo.it>
Acked-by: Jeff Dike <jdike@addtoit.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
  • Loading branch information
Paolo 'Blaisorblade' Giarrusso authored and Linus Torvalds committed Mar 8, 2007
1 parent a6eb0be commit 83f4e8a
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion arch/um/drivers/mcast_user.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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,
Expand Down

0 comments on commit 83f4e8a

Please sign in to comment.