[ofa-general] Re: [PATCH] opensm/osm_perfmgr_db.c: Fix memory leak of db nodes
Sasha Khapyorsky
sashak at voltaire.com
Sat Sep 19 10:47:01 PDT 2009
Hi Hal,
On 10:31 Fri 18 Sep , Hal Rosenstock wrote:
>
> Signed-off-by: Hal Rosenstock <hal.rosenstock at gmail.com>
> ---
> diff --git a/opensm/opensm/osm_perfmgr_db.c b/opensm/opensm/osm_perfmgr_db.c
> index e5dfc19..329743a 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,16 @@ perfmgr_db_t *perfmgr_db_construct(osm_perfmgr_t *perfmgr)
> */
> void perfmgr_db_destroy(perfmgr_db_t * db)
> {
> + cl_map_item_t *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;
> + free_node(node);
> + item = cl_qmap_next(item);
Use after free (memory pointed by item is freed already)?
Sasha
> + }
> cl_plock_destroy(&db->lock);
> free(db);
> }
>
More information about the general
mailing list