[PATCH] bfd: alpha: Fix crash caused by double free

Alan Modra amodra@gmail.com
Mon Jan 2 05:14:00 GMT 2017


On Sat, Dec 31, 2016 at 12:32:18PM +0000, James Clarke wrote:
> @@ -3228,11 +3228,13 @@ elf64_alpha_relax_opt_call (struct alpha_relax_info *info, bfd_vma symval)
>  
>        if (!gpdisp || gpdisp->r_addend != 4)
>  	{
> -	  if (tsec_free)
> +	  if (tsec_free != NULL
> +	      && elf_section_data (info->tsec)->relocs != tsec_free)
>  	    free (tsec_free);
>  	  return 0;
>  	}
> -      if (tsec_free)
> +      if (tsec_free != NULL
> +          && elf_section_data (info->tsec)->relocs != tsec_free)
>          free (tsec_free);
>      }
>  

Please move the new test to the assignment of tsec_free.  OK with that
change, thanks!

-- 
Alan Modra
Australia Development Lab, IBM



More information about the Binutils mailing list