On 08:51 Mon 21 Sep     , Hal Rosenstock wrote:
> 
> Signed-off-by: Hal Rosenstock <hal.rosenst...@gmail.com>
> ---
> Changes since v1:
> Fix use after free issue
> 
> diff --git a/opensm/opensm/osm_perfmgr_db.c b/opensm/opensm/osm_perfmgr_db.c
> index e5dfc19..03f988d 100644
> --- a/opensm/opensm/osm_perfmgr_db.c
> +++ b/opensm/opensm/osm_perfmgr_db.c
> @@ -49,6 +49,8 @@
>  #include <opensm/osm_perfmgr.h>
>  #include <opensm/osm_opensm.h>
>  
> +static void free_node(db_node_t * node);
> +
>  /** =========================================================================
>   */
>  perfmgr_db_t *perfmgr_db_construct(osm_perfmgr_t *perfmgr)
> @@ -68,7 +70,17 @@ perfmgr_db_t *perfmgr_db_construct(osm_perfmgr_t *perfmgr)
>   */
>  void perfmgr_db_destroy(perfmgr_db_t * db)
>  {
> +     cl_map_item_t *item, *next_item;
> +     db_node_t *node;
> +
>       if (db) {
> +             item = cl_qmap_head(&db->pc_data);
> +             while (item != cl_qmap_end(&db->pc_data)) {
> +                     node = (db_node_t *)item;
> +                     next_item = cl_qmap_next(item);
> +                     free_node(node);
> +                     item = next_item;
> +             }

And why do you need both 'item' and 'node' variables?

Sasha

>               cl_plock_destroy(&db->lock);
>               free(db);
>       }
> 
_______________________________________________
general mailing list
general@lists.openfabrics.org
http://lists.openfabrics.org/cgi-bin/mailman/listinfo/general

To unsubscribe, please visit http://openib.org/mailman/listinfo/openib-general

Reply via email to