From deddf0b33e23921b5a45951b041cd2f23de3f664 Mon Sep 17 00:00:00 2001 From: Nathan Hjelm Date: Thu, 15 Mar 2012 20:13:20 +0000 Subject: [PATCH] ugni: fix frag leak in sendi This commit was SVN r26152. --- ompi/mca/btl/ugni/btl_ugni_sendi.c | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/ompi/mca/btl/ugni/btl_ugni_sendi.c b/ompi/mca/btl/ugni/btl_ugni_sendi.c index b10743b3b4..12844ed815 100644 --- a/ompi/mca/btl/ugni/btl_ugni_sendi.c +++ b/ompi/mca/btl/ugni/btl_ugni_sendi.c @@ -86,13 +86,20 @@ int mca_btl_ugni_sendi (struct mca_btl_base_module_t *btl, /* send message */ if (length <= mca_btl_ugni_component.smsg_max_data) { - return ompi_mca_btl_ugni_smsg_send (frag, false, &frag->hdr.send, sizeof (frag->hdr.send), - frag->segments[0].seg_addr.pval, length, MCA_BTL_UGNI_TAG_SEND); + rc = ompi_mca_btl_ugni_smsg_send (frag, false, &frag->hdr.send, sizeof (frag->hdr.send), + frag->segments[0].seg_addr.pval, length, MCA_BTL_UGNI_TAG_SEND); } else { frag->hdr.eager.src_seg = frag->segments[0]; frag->hdr.eager.ctx = (void *) &frag->post_desc; - return ompi_mca_btl_ugni_smsg_send (frag, true, &frag->hdr.eager, sizeof (frag->hdr.eager), - NULL, 0, MCA_BTL_UGNI_TAG_GET_INIT); + rc = ompi_mca_btl_ugni_smsg_send (frag, true, &frag->hdr.eager, sizeof (frag->hdr.eager), + NULL, 0, MCA_BTL_UGNI_TAG_GET_INIT); } + + if (OPAL_UNLIKELY(OMPI_SUCCESS != rc)) { + /* return this frag */ + mca_btl_ugni_frag_return (frag); + } + + return rc; }