Skip to content

Commit

Permalink
NULL the overflow buffer
Browse files Browse the repository at this point in the history
  • Loading branch information
philippe44 committed Apr 5, 2023
1 parent 8d1888a commit 3372aae
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions components/squeezelite/opus.c
Original file line number Diff line number Diff line change
Expand Up @@ -187,7 +187,6 @@ static int read_opus_header(void) {
switch (u->status) {
case OGG_SYNC:
u->status = OGG_HEADER;
//OG(&gu, sync_pageout, &u->sync, &u->page);
OG(&gu, stream_reset_serialno, &u->state, OG(&gu, page_serialno, &u->page));
break;
case OGG_HEADER:
Expand Down Expand Up @@ -352,9 +351,9 @@ static decode_state opus_decompress(void) {
}

static void opus_open(u8_t size, u8_t rate, u8_t chan, u8_t endianness) {
if (u->decoder) OP(&gu, decoder_destroy, u->decoder);

if (u->decoder) OP(&gu, decoder_destroy, u->decoder);
if (!u->overbuf) u->overbuf = malloc(MAX_OPUS_FRAMES * BYTES_PER_FRAME);

u->status = OGG_SYNC;
u->fetch = true;
u->overframes = 0;
Expand All @@ -365,7 +364,10 @@ static void opus_open(u8_t size, u8_t rate, u8_t chan, u8_t endianness) {

static void opus_close(void) {
if (u->decoder) OP(&gu, decoder_destroy, u->decoder);

free(u->overbuf);
u->overbuf = NULL;

OG(&gu, stream_clear, &u->state);
OG(&gu, sync_clear, &u->sync);
}
Expand Down

0 comments on commit 3372aae

Please sign in to comment.