From: Jack Morgenstein Date: Fri, 9 Dec 2005 21:46:32 +0000 (-0800) Subject: IB/umad: fix memory leaks X-Git-Tag: v2.6.16-rc1~678^2~22 X-Git-Url: https://openfabrics.org/gitweb/?a=commitdiff_plain;h=0efc4883a6b3de12476cd7a35e638c0a9f5fd75f;p=~emulex%2Finfiniband.git 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 Signed-off-by: Michael S. Tsirkin Signed-off-by: Roland Dreier --- diff --git a/drivers/infiniband/core/user_mad.c b/drivers/infiniband/core/user_mad.c index eb7f52537cc..c908de8db5a 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);