[ofa-general] [PATCH] opensm/osm_switch.c: In osm_switch_delete, set priv to NULL

Hal Rosenstock hnrose at comcast.net
Fri Jul 24 16:04:47 PDT 2009


This can help with finding use after free issues if memory not reused
updn and lash rely on this priv pointer and may have stale
osm_switch_t pointers

Signed-off-by: Hal Rosenstock <hal.rosenstock at gmail.com>
---
diff --git a/opensm/opensm/osm_switch.c b/opensm/opensm/osm_switch.c
index ce1ca63..e23b32f 100644
--- a/opensm/opensm/osm_switch.c
+++ b/opensm/opensm/osm_switch.c
@@ -94,6 +94,7 @@ void osm_switch_delete(IN OUT osm_switch_t ** const pp_sw)
 				free(p_sw->hops[i]);
 		free(p_sw->hops);
 	}
+	p_sw->priv = NULL;
 	free(*pp_sw);
 	*pp_sw = NULL;
 }



More information about the general mailing list