summaryrefslogtreecommitdiffstats
path: root/drivers/infiniband/core/user_mad.c
diff options
context:
space:
mode:
authorJack Morgenstein2005-12-09 22:46:32 +0100
committerRoland Dreier2005-12-09 22:46:32 +0100
commit0efc4883a6b3de12476cd7a35e638c0a9f5fd75f (patch)
tree5d15957003282be61923d1ba475b49538ec87ac9 /drivers/infiniband/core/user_mad.c
parentIB/cm: avoid reusing local ID (diff)
downloadkernel-qcow2-linux-0efc4883a6b3de12476cd7a35e638c0a9f5fd75f.tar.gz
kernel-qcow2-linux-0efc4883a6b3de12476cd7a35e638c0a9f5fd75f.tar.xz
kernel-qcow2-linux-0efc4883a6b3de12476cd7a35e638c0a9f5fd75f.zip
IB/umad: fix memory leaks
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>
Diffstat (limited to 'drivers/infiniband/core/user_mad.c')
-rw-r--r--drivers/infiniband/core/user_mad.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/drivers/infiniband/core/user_mad.c b/drivers/infiniband/core/user_mad.c
index eb7f52537ccc..c908de8db5a9 100644
--- a/drivers/infiniband/core/user_mad.c
+++ b/drivers/infiniband/core/user_mad.c
@@ -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);