RISC-V: Fix target attribute subset list ownership
Corrects memory management for RISC-V target attribute subset lists to prevent double-frees and memory leaks.
This change addresses memory management issues within the RISC-V target attribute parser. It ensures that the old subset pointer is cleared before a new one is parsed, preventing a double-free when an XLEN mismatch occurs. Additionally, a destructor was added to release any remaining subset list on parser destruction, fixing potential memory leaks.
In Details
The riscv_target_attr_parser in the RISC-V backend now correctly handles ownership of the subset list. A destructor is introduced to manage the memory for the m_target_subset_list, and the parse_arch function clears the m_subsets pointer before reassigning it. This resolves a double-free issue when an XLEN mismatch occurs and prevents leaks when the parser is destroyed with a partially parsed attribute.