]> git.openfabrics.org - ~shefty/rdma-win.git/commitdiff
[LIBIBUMAD] libibumad: fix freeing wrong memory on failure
authorStan Smith <stan.smith@intel.com>
Fri, 22 Jan 2010 23:02:38 +0000 (23:02 +0000)
committerStan Smith <stan.smith@intel.com>
Fri, 22 Jan 2010 23:02:38 +0000 (23:02 +0000)
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 <sean.hefty@intel.com>
git-svn-id: svn://openib.tc.cornell.edu/gen1@2677 ad392aa1-c5ef-ae45-8dd8-e69d62a5ef86

branches/WOF2-2/ulp/libibumad/src/umad.cpp

index 62473e358afa793408012d5ca757fd90f6d99b94..8fd70b1fec9fba55967188f5de1b1b3aba451eb5 100644 (file)
@@ -221,6 +221,7 @@ int umad_get_ca(char *ca_name, umad_ca_t *ca)
 \r
                ret = umad_query_port(context, ca->ports[i]);\r
                if (ret != 0) {\r
+                       delete ports;\r
                        goto close;\r
                }\r
        }\r
@@ -229,9 +230,6 @@ close:
        ibv_close_device(context);\r
 free:\r
        ibv_free_device_list(list);\r
-       if (ret != 0) {\r
-               delete ca;\r
-       }\r
        return ret;\r
 }\r
 \r