Skip to content

Conversation

@Amit-Matth
Copy link

@Amit-Matth Amit-Matth commented Feb 3, 2026

Description:

This PR addresses a strict memory safety issue in speex_echo_state_init_mc where internal buffer allocations were not being checked for failure.

Changes:

  • Added NULL checks for all internal memory allocations (st->e, st->x, st->input, etc.) in lib/speexdsp/libspeexdsp/mdf.c

  • Implemented a proper cleanup mechanism: if any allocation fails, speex_echo_state_destroy is called to free previously allocated memory, and NULL is returned.

  • Updated speex_echo_state_destroy to safely handle NULL for st->fft_table to prevent crashes during error recovery.

Impact: Prevents potential null pointer dereferences and crashes in low-memory environments.

Related Issue: #82

@joseph-yiu
Copy link
Contributor

Thanks for this pull request. It looks fine to me.
regards,
Joseph

@joseph-yiu
Copy link
Contributor

Merged into dev branch (dev_2026q1).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants