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>
This commit is contained in:
committed by
Roland Dreier
parent
de1bb1a64c
commit
0efc4883a6
@@ -197,8 +197,8 @@ static void send_handler(struct ib_mad_agent *agent,
|
|||||||
memcpy(timeout->mad.data, packet->mad.data,
|
memcpy(timeout->mad.data, packet->mad.data,
|
||||||
sizeof (struct ib_mad_hdr));
|
sizeof (struct ib_mad_hdr));
|
||||||
|
|
||||||
if (!queue_packet(file, agent, timeout))
|
if (queue_packet(file, agent, timeout))
|
||||||
return;
|
kfree(timeout);
|
||||||
}
|
}
|
||||||
out:
|
out:
|
||||||
kfree(packet);
|
kfree(packet);
|
||||||
|
Reference in New Issue
Block a user