Skip to content

Commit c2327bd

Browse files
QuzarDCQuzarDC
authored andcommitted
Prevent double-init of snd_stream.
Without this protection, there would be a memory leak caused by separation buffers being allocated multiple times.
1 parent 138477b commit c2327bd

1 file changed

Lines changed: 6 additions & 0 deletions

File tree

kernel/arch/dreamcast/sound/snd_stream.c

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -322,6 +322,12 @@ int snd_stream_init(void) {
322322
}
323323

324324
int snd_stream_init_ex(int channels, size_t buffer_size) {
325+
326+
if(!sep_buffer[0]) {
327+
dbglog(DBG_ERROR, "snd_stream_init_ex(): already initialized\n");
328+
return -1;
329+
}
330+
325331
max_channels = channels;
326332

327333
if(buffer_size > 0) {

0 commit comments

Comments
 (0)