Skip to contentSkip to conversation

opensm/osm_lid_mgr.c: fix memory leak

PATCH New Sasha Khapyorsky 1 participant 1 message Apr 25, 2010 InfiniBand

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 opensm/osm_lid_mgr.c: fix memory leak

When during LIDs assignment process free lid range is consumed its memory should be freed (as well as removing from free ranges list).

---
 opensm/opensm/osm_lid_mgr.c |    5 +++--
 1 files changed, 3 insertions(+), 2 deletions(-)
opensm/opensm/osm_lid_mgr.c +3 -2
index f14d377..9896196 100644
@@ -636,11 +636,12 @@ static void lid_mgr_find_free_lid_range(IN osm_lid_mgr_t * p_mgr,
 		/* but we can be out of the range */
 		if (lid + num_lids - 1 <= p_range->max_lid) {
 			/* ok let us use that range */
-			if (lid + num_lids - 1 == p_range->max_lid)
+			if (lid + num_lids - 1 == p_range->max_lid) {
 				/* we consumed the entire range */
 				cl_qlist_remove_item(&p_mgr->free_ranges,
 						     p_item);
-			else
+				free(p_item);
+			} else
 				/* only update the available range */
 				p_range->min_lid = lid + num_lids;
 
Signature · 6 lines
1.7.0.4

--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html