Fix memory leaks - release and invalidate allocated umad port resources.

Signed-off-by: Sasha Khapyorsky <[EMAIL PROTECTED]>
---
 opensm/libvendor/osm_vendor_ibumad.c |    6 ++++++
 1 files changed, 6 insertions(+), 0 deletions(-)

diff --git a/opensm/libvendor/osm_vendor_ibumad.c 
b/opensm/libvendor/osm_vendor_ibumad.c
index 9e186d5..5668c5e 100644
--- a/opensm/libvendor/osm_vendor_ibumad.c
+++ b/opensm/libvendor/osm_vendor_ibumad.c
@@ -725,6 +725,8 @@ osm_vendor_open_port(IN osm_vendor_t * const p_vend,
                        "osm_vendor_open_port: ERR 5423: "
                        "Unable to alloc receiver struct\n");
                umad_close_port(umad_port_id);
+               umad_release_port(&p_vend->umad_port);
+               p_vend->umad_port.port_guid = 0;
                p_vend->umad_port_id = umad_port_id = -1;
                goto Exit;
        }
@@ -733,6 +735,8 @@ osm_vendor_open_port(IN osm_vendor_t * const p_vend,
                        "osm_vendor_open_port: ERR 5420: "
                        "umad_receiver_init failed\n");
                umad_close_port(umad_port_id);
+               umad_release_port(&p_vend->umad_port);
+               p_vend->umad_port.port_guid = 0;
                p_vend->umad_port_id = umad_port_id = -1;
        }
 
@@ -758,6 +762,8 @@ static void osm_vendor_close_port(osm_vendor_t * const 
p_vend)
                        if (p_vend->agents[i])
                                umad_unregister(p_vend->umad_port_id, i);
                umad_close_port(p_vend->umad_port_id);
+               umad_release_port(&p_vend->umad_port);
+               p_vend->umad_port.port_guid = 0;
                p_vend->umad_port_id = -1;
        }
 }
-- 
1.5.3.rc2.29.gc4640f

_______________________________________________
general mailing list
[email protected]
http://lists.openfabrics.org/cgi-bin/mailman/listinfo/general

To unsubscribe, please visit http://openib.org/mailman/listinfo/openib-general

Reply via email to