This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [Ada] fix potential memory corruption in annotated value cache


On Fri, Sep 16, 2011 at 04:02:32AM -0300, Alexandre Oliva wrote:
> -      struct tree_int_map in;
> +      struct tree_int_map **h;
> +
>        if (!annotate_value_cache)
>          annotate_value_cache = htab_create_ggc (512, tree_int_map_hash,
>  					        tree_int_map_eq, 0);
>        in.base.from = gnu_size;
>        h = (struct tree_int_map **)
> -	    htab_find_slot (annotate_value_cache, &in, INSERT);
> +	    htab_find_slot (annotate_value_cache, &in, NO_INSERT);

I wonder why don't you use htab_find instead here.

> -      if (*h)
> +      if (h)
>  	return (Node_Ref_Or_Val) (*h)->to;
>      }

	Jakub


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]