Skip to content

Commit

Permalink
codec: vorbis: refactor error path behind goto
Browse files Browse the repository at this point in the history
  • Loading branch information
alexandre-janniaux authored and fkuehne committed Jan 13, 2023
1 parent e503d9a commit 08dce4f
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions modules/codec/vorbis.c
Original file line number Diff line number Diff line change
Expand Up @@ -798,12 +798,10 @@ static int OpenEncoder( vlc_object_t *p_this )
p_enc->fmt_in.audio.i_channels, p_enc->fmt_in.audio.i_rate,
i_quality * 0.1 ) )
{
vorbis_info_clear( &p_sys->vi );
free( p_enc->p_sys );
msg_Err( p_enc, "VBR mode initialisation failed %"PRIu8"x(%uHz,q=%d)",
p_enc->fmt_in.audio.i_channels,
p_enc->fmt_in.audio.i_rate, i_quality );
return VLC_EGENERIC;
goto error;
}

/* Do we have optional hard quality restrictions? */
Expand Down Expand Up @@ -833,13 +831,11 @@ static int OpenEncoder( vlc_object_t *p_this )
p_enc->fmt_out.i_bitrate,
i_max_bitrate > 0 ? i_max_bitrate * 1000: -1 ) )
{
vorbis_info_clear( &p_sys->vi );
msg_Err( p_enc, "CBR mode initialisation failed %"PRIu8"x(%uHz,r=%u)",
p_enc->fmt_in.audio.i_channels,
p_enc->fmt_in.audio.i_rate,
p_enc->fmt_out.i_bitrate);
free( p_enc->p_sys );
return VLC_EGENERIC;
goto error;
}
}

Expand Down Expand Up @@ -889,6 +885,10 @@ static int OpenEncoder( vlc_object_t *p_this )
p_enc->ops = &ops;

return VLC_SUCCESS;
error:
vorbis_info_clear( &p_sys->vi );
free(p_sys);
return VLC_EGENERIC;
}

/****************************************************************************
Expand Down

0 comments on commit 08dce4f

Please sign in to comment.