[ofa-general] Re: [PATCH v3] osm: QoS - parsing port names

Sasha Khapyorsky sashak at voltaire.com
Sun Oct 21 04:53:27 PDT 2007


On 10:00 Sun 21 Oct     , Yevgeny Kliteynik wrote:
> >> +		if (!st_lookup(p_qos_policy->p_node_hash,
> >> +			      (st_data_t)p_node->print_desc,
> >> +			      (st_data_t*)&p_node))
> >> +			st_insert(p_qos_policy->p_node_hash,
> >> +				  (st_data_t)p_node->print_desc,
> >> +				  (st_data_t)p_node);
> > st_lookup() is not needed? st_insert() replace entry if it exists. In
> > case of identical node_desc last will appear.
> 
>  Whether the first or the last appearance will remain in the hash,
>  it's bad either way, but if the value in the hash will be replaced,
>  it will create memory leak, since the previous value won't be freed.

Hmm, right, st_* does internal allocation - I missed this.

Sasha



More information about the general mailing list