Skip to content

Commit

Permalink
IB/umad: fix memory leaks
Browse files Browse the repository at this point in the history
Don't leak packet if it had a timeout, and don't leak timeout struct
if queue_packet() fails.

Signed-off-by: Jack Morgenstein <jackm@mellanox.co.il>
Signed-off-by: Michael S. Tsirkin <mst@mellanox.co.il>
Signed-off-by: Roland Dreier <rolandd@cisco.com>
  • Loading branch information
Jack Morgenstein authored and Roland Dreier committed Dec 9, 2005
1 parent de1bb1a commit 0efc488
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions drivers/infiniband/core/user_mad.c
Original file line number Diff line number Diff line change
Expand Up @@ -197,8 +197,8 @@ static void send_handler(struct ib_mad_agent *agent,
memcpy(timeout->mad.data, packet->mad.data,
sizeof (struct ib_mad_hdr));

if (!queue_packet(file, agent, timeout))
return;
if (queue_packet(file, agent, timeout))
kfree(timeout);
}
out:
kfree(packet);
Expand Down

0 comments on commit 0efc488

Please sign in to comment.