[ofa-general] [PATCH] opensm/osm_sa: fix memory leak in SA responder

Sasha Khapyorsky sashak at voltaire.com
Sun Oct 19 08:14:50 PDT 2008


On each SA response (osm_sa_respond()) OpenSM eats memory. free() at end
of the function does not work because all items were removed from the
list already. Fixing this.

Signed-off-by: Sasha Khapyorsky <sashak at voltaire.com>
---
 opensm/opensm/osm_sa.c |    1 +
 1 files changed, 1 insertions(+), 0 deletions(-)

diff --git a/opensm/opensm/osm_sa.c b/opensm/opensm/osm_sa.c
index 670deae..fb2f962 100644
--- a/opensm/opensm/osm_sa.c
+++ b/opensm/opensm/osm_sa.c
@@ -494,6 +494,7 @@ void osm_sa_respond(osm_sa_t *sa, osm_madw_t *madw, size_t attr_size,
 		item = cl_qlist_remove_head(list);
 		memcpy(p, ((struct item_data *)item)->data, attr_size);
 		p += attr_size;
+		free(item);
 	}
 
 	osm_sa_send(sa, resp_madw, FALSE);
-- 
1.6.0.2.287.g3791f




More information about the general mailing list