aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAndreas Rheinhardt <andreas.rheinhardt@gmail.com>2020-09-13 00:22:28 +0200
committerAndreas Rheinhardt <andreas.rheinhardt@gmail.com>2020-09-17 00:09:08 +0200
commit0b45ac571713cc8fda7aa5381c68ad671d21504b (patch)
tree4ce169ad81e91079793bf26a709c20b7f904f249
parent771f91532c5cb65666820f1156b3a0e1661a3102 (diff)
downloadffmpeg-0b45ac571713cc8fda7aa5381c68ad671d21504b.tar.gz
avcodec/roqaudioenc: Avoid redundant free of unallocated buffer
If allocating a buffer in RoQ DPCM encoder's init function failed, the close function would be called manually; all this function does is freeing said buffer, but given that it has not been allocated at all, this is unnecessary. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
-rw-r--r--libavcodec/roqaudioenc.c10
1 files changed, 2 insertions, 8 deletions
diff --git a/libavcodec/roqaudioenc.c b/libavcodec/roqaudioenc.c
index 5154604be8..c09212d3d1 100644
--- a/libavcodec/roqaudioenc.c
+++ b/libavcodec/roqaudioenc.c
@@ -53,7 +53,6 @@ static av_cold int roq_dpcm_encode_close(AVCodecContext *avctx)
static av_cold int roq_dpcm_encode_init(AVCodecContext *avctx)
{
ROQDPCMContext *context = avctx->priv_data;
- int ret;
if (avctx->channels > 2) {
av_log(avctx, AV_LOG_ERROR, "Audio must be mono or stereo\n");
@@ -70,17 +69,12 @@ static av_cold int roq_dpcm_encode_init(AVCodecContext *avctx)
context->frame_buffer = av_malloc(8 * ROQ_FRAME_SIZE * avctx->channels *
sizeof(*context->frame_buffer));
- if (!context->frame_buffer) {
- ret = AVERROR(ENOMEM);
- goto error;
- }
+ if (!context->frame_buffer)
+ return AVERROR(ENOMEM);
context->lastSample[0] = context->lastSample[1] = 0;
return 0;
-error:
- roq_dpcm_encode_close(avctx);
- return ret;
}
static unsigned char dpcm_predict(short *previous, short current)