From 728c8ff051e500f73b92bf2a5bb16046aa965dba Mon Sep 17 00:00:00 2001 From: Stan Smith Date: Fri, 22 Jan 2010 23:02:38 +0000 Subject: [PATCH] [LIBIBUMAD] libibumad: fix freeing wrong memory on failure 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 git-svn-id: svn://openib.tc.cornell.edu/gen1@2677 ad392aa1-c5ef-ae45-8dd8-e69d62a5ef86 --- branches/WOF2-2/ulp/libibumad/src/umad.cpp | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/branches/WOF2-2/ulp/libibumad/src/umad.cpp b/branches/WOF2-2/ulp/libibumad/src/umad.cpp index 62473e35..8fd70b1f 100644 --- a/branches/WOF2-2/ulp/libibumad/src/umad.cpp +++ b/branches/WOF2-2/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; } -- 2.46.0