Re: [PATCH 11/19] RISC-V: avoid strdup()
Project / Subsystem
binutils / risc-v
Date
2026-04-29
Proposer
Jiawei <jiawei@iscas.ac.cn>
Source type
public_inbox
Consensus
Ready to Land
Sentiment
—/10
Technical tradeoffs
- • Using ``xstrdup()`` adds a dependency on the custom memory allocation functions.
- • The program will exit with a fatal error instead of continuing with potentially corrupted data.
All attributes
- project
- binutils
- subsystem
- risc-v
- patch_id
- —
- discussion_id
- eafb3dd1-bd0c-4713-9bc0-af2978fdfe62@iscas.ac.cn
- source_type
- public_inbox
- title
- Re: [PATCH 11/19] RISC-V: avoid strdup()
- headline
- RISC-V: Avoid strdup()
- tldr
- Replaces ``strdup()`` with ``xstrdup()`` in several places within the RISC-V backend.
- proposer
- Jiawei <jiawei@iscas.ac.cn>
- consensus
- Ready to Land
- outcome
- ready
- sentiment_score
- —
- technical_tradeoffs
-
- • Using ``xstrdup()`` adds a dependency on the custom memory allocation functions.
- • The program will exit with a fatal error instead of continuing with potentially corrupted data.
- series_id
- binutils:risc-v: avoid strdup()
- series_role
- reply
- series_parts
- []
- tags
-
- • risc-v
- • memory management
- • strdup
- • xstrdup
- bugzilla_url
- —
- date
- 2026-04-29T00:00:00.000Z
Re: [PATCH 11/19] RISC-V: avoid strdup()
This patch replaces instances of strdup() with xstrdup() in the RISC-V backend. xstrdup() is a safer version of strdup() that handles memory allocation failures by calling xmalloc(), ensuring the program exits if memory allocation fails. This change improves the robustness of the code by preventing potential crashes due to out-of-memory conditions.