[openib-general] [PATCH] fix memory leak in ib_mad_recv_done_handler
Krishna Kumar
krkumar at us.ibm.com
Thu Nov 4 13:31:28 PST 2004
Also, updated a comment so that it is known that the recv_handler
(when it is implemented) is in charge of freeing up recv during it's
processing. Applies to gen2/trunk.
Thanks,
- KK
diff -ruNp 1/mad.c 2/mad.c
--- 1/mad.c 2004-11-04 10:38:30.000000000 -0800
+++ 2/mad.c 2004-11-04 13:26:39.000000000 -0800
@@ -1045,14 +1045,16 @@ static void ib_mad_recv_done_handler(str
solicited);
if (mad_agent) {
ib_mad_complete_recv(mad_agent, recv, solicited);
- recv = NULL; /* recv is freed up via ib_mad_complete_recv */
+ /*
+ * recv is freed up in error cases in ib_mad_complete_recv
+ * or via recv_handler in ib_mad_complete_recv().
+ */
+ recv = NULL;
}
out:
- if (recv) {
- /* Should this case be optimized ? */
- kmem_cache_free(ib_mad_cache, recv);
- }
+ if (recv)
+ ib_free_recv_mad(&recv->header.recv_wc);
/* Post another receive request for this QP */
ib_mad_post_receive_mad(qp_info);
More information about the general
mailing list