[ofw] [PATCH] libibumad: fix freeing wrong memory on failure
Sean Hefty
sean.hefty at intel.com
Mon Jan 18 10:32:48 PST 2010
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 at intel.com>
---
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;
}
More information about the ofw
mailing list