Skip to content

Fix memory allocation bug in JPVerb#416

Merged
capital-G merged 4 commits intosupercollider:mainfrom
capital-G:jpverb-memory-fix
Jan 29, 2026
Merged

Fix memory allocation bug in JPVerb#416
capital-G merged 4 commits intosupercollider:mainfrom
capital-G:jpverb-memory-fix

Conversation

@capital-G
Copy link
Contributor

The old code uses

unit->mDSP = new(RTAlloc(unit->mWorld, sizeof(FAUSTCLASS))) FAUSTCLASS();

If RTAlloc fails, it will return a nullptr: but putting an instance of FAUSTCLASS (or anything at all) to the nullptr is undefined behavior and will lead to a crash.

@capital-G
Copy link
Contributor Author

@Spacechild1 - sorry for re-pining. I also fixed some memory leaks while I am at it and made the error handling more generic, please check if this is okay. If so I think this is ready to be merged (not squashed).

also set default calc function
@capital-G
Copy link
Contributor Author

ping @Spacechild1

@capital-G capital-G requested a review from Spacechild1 January 29, 2026 16:17
@capital-G capital-G merged commit 0677511 into supercollider:main Jan 29, 2026
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants