Landing: 57d9dfcf39cd

Project / Subsystem

binutils / binutils/bfd

Date

2026-07-07

Author

Alan Modra <amodra@sourceware.org>

Commit

57d9dfcf39cd3c2897bb76c2dbd7074f065685df

Source

public_inbox

Perf win

No

Breaking

No

All attributes

project
binutils
subsystem
binutils/bfd
patch_id
commit_hash
57d9dfcf39cd3c2897bb76c2dbd7074f065685df
source_type
public_inbox
headline
Check results of bfd_alloc calls in elf.c
tldr
Binutils elf.c now checks for allocation failures to prevent crashes.
author
Alan Modra <amodra@sourceware.org>
outcome
committed
performance_win
false
breaking_change
false
series_id
series_parts
[]
tags
  • binutils
  • bfd
  • error handling
  • memory allocation
  • elf
discussion_id_link
public_inbox:binutils#34131
bugzilla_pr
date
2026-07-07T00:00:00.000Z

This commit enhances error handling in binutils’ elf.c by checking the return values of bfd_zalloc and bfd_alloc. Previously, the code did not explicitly check if these memory allocation calls returned NULL, which could lead to crashes if memory allocation failed. The change also simplifies some code by removing unnecessary type casts and temporary variables.