Commit 0efc4883 authored by Jack Morgenstein's avatar Jack Morgenstein Committed by Roland Dreier
Browse files

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: default avatarJack Morgenstein <jackm@mellanox.co.il>
Signed-off-by: default avatarMichael S. Tsirkin <mst@mellanox.co.il>
Signed-off-by: default avatarRoland Dreier <rolandd@cisco.com>
parent de1bb1a6
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -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);