umad_get_ca() should free the allocated 'ports' memory on failure,
not the ca structure, which is provided by the user.

Bug reported by Leonid Keller.

Signed-off-by: Sean Hefty <[email protected]>
---
 trunk/ulp/libibumad/src/umad.cpp |    4 +---
 1 files changed, 1 insertions(+), 3 deletions(-)

diff --git a/trunk/ulp/libibumad/src/umad.cpp b/trunk/ulp/libibumad/src/umad.cpp
index 62473e3..8fd70b1 100644
--- a/trunk/ulp/libibumad/src/umad.cpp
+++ b/trunk/ulp/libibumad/src/umad.cpp
@@ -221,6 +221,7 @@ int umad_get_ca(char *ca_name, umad_ca_t *ca)
 
                ret = umad_query_port(context, ca->ports[i]);
                if (ret != 0) {
+                       delete ports;
                        goto close;
                }
        }
@@ -229,9 +230,6 @@ close:
        ibv_close_device(context);
 free:
        ibv_free_device_list(list);
-       if (ret != 0) {
-               delete ca;
-       }
        return ret;
 }
 


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

Reply via email to