[ofa-general] [PATCH - libibumad] Added release_ca in error flow to prevent resource leak

Dotan Barak dotanb at dev.mellanox.co.il
Sun Mar 11 06:42:14 PDT 2007


Added release_ca in error flow to prevent resource leak.

Signed-off-by: Dotan Barak <dotanb at mellanox.co.il>

---

Index: gen2_devel_user/src/userspace/management/libibumad/src/umad.c
===================================================================
--- gen2_devel_user.orig/src/userspace/management/libibumad/src/umad.c	2007-02-08 17:01:40.000000000 +0200
+++ gen2_devel_user/src/userspace/management/libibumad/src/umad.c	2007-02-12 17:13:22.000000000 +0200
@@ -538,8 +538,10 @@ umad_get_ca_portguids(char *ca_name, uin
 		return -1;
 
 	if (portguids) {
-		if (ca.numports + 1 > max)
+		if (ca.numports + 1 > max) {
+			release_ca(&ca);
 			return -ENOMEM;
+		}
 
 		for (i = 0; i <= ca.numports; i++)
 			portguids[ports++] = ca.ports[i] ? ca.ports[i]->port_guid : 0;





More information about the general mailing list