[PATCH 2/3] RISC-V: Free the returned string of riscv_arch_str if we call it multiple times
Jan Beulich
jbeulich@suse.com
Thu Mar 13 07:45:20 GMT 2025
On 13.03.2025 03:31, Nelson Chu wrote:
> @@ -4001,6 +4001,10 @@ riscv_merge_arch_attr_info (bfd *ibfd, char *in_arch, char *out_arch)
> return NULL;
> }
>
> + /* Free the previous merged_arch_str which called xmalloc. */
> + if (merged_arch_str != NULL)
> + free ((void *) merged_arch_str);
Nit: There's no need for the cast in modern C, and there's also no need for the
NULL check, as free() deals with NULL just fine.
Jan
More information about the Binutils
mailing list