avcodec/wma(dec|enc): Fix memleaks upon allocation error

ff_wma_init() can fail without freeing everything it has allocated;
so add the FF_CODEC_CAP_INIT_CLEANUP to the codecs using it.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
pull/362/head
Andreas Rheinhardt 4 years ago
parent 0bc522a0a1
commit fcdb012a10
  1. 2
      libavcodec/wmadec.c
  2. 2
      libavcodec/wmaenc.c

@ -977,6 +977,7 @@ const AVCodec ff_wmav1_decoder = {
.capabilities = AV_CODEC_CAP_DR1, .capabilities = AV_CODEC_CAP_DR1,
.sample_fmts = (const enum AVSampleFormat[]) { AV_SAMPLE_FMT_FLTP, .sample_fmts = (const enum AVSampleFormat[]) { AV_SAMPLE_FMT_FLTP,
AV_SAMPLE_FMT_NONE }, AV_SAMPLE_FMT_NONE },
.caps_internal = FF_CODEC_CAP_INIT_CLEANUP,
}; };
#endif #endif
#if CONFIG_WMAV2_DECODER #if CONFIG_WMAV2_DECODER
@ -993,5 +994,6 @@ const AVCodec ff_wmav2_decoder = {
.capabilities = AV_CODEC_CAP_DR1, .capabilities = AV_CODEC_CAP_DR1,
.sample_fmts = (const enum AVSampleFormat[]) { AV_SAMPLE_FMT_FLTP, .sample_fmts = (const enum AVSampleFormat[]) { AV_SAMPLE_FMT_FLTP,
AV_SAMPLE_FMT_NONE }, AV_SAMPLE_FMT_NONE },
.caps_internal = FF_CODEC_CAP_INIT_CLEANUP,
}; };
#endif #endif

@ -436,6 +436,7 @@ const AVCodec ff_wmav1_encoder = {
.close = ff_wma_end, .close = ff_wma_end,
.sample_fmts = (const enum AVSampleFormat[]) { AV_SAMPLE_FMT_FLTP, .sample_fmts = (const enum AVSampleFormat[]) { AV_SAMPLE_FMT_FLTP,
AV_SAMPLE_FMT_NONE }, AV_SAMPLE_FMT_NONE },
.caps_internal = FF_CODEC_CAP_INIT_CLEANUP,
}; };
#endif #endif
#if CONFIG_WMAV2_ENCODER #if CONFIG_WMAV2_ENCODER
@ -450,5 +451,6 @@ const AVCodec ff_wmav2_encoder = {
.close = ff_wma_end, .close = ff_wma_end,
.sample_fmts = (const enum AVSampleFormat[]) { AV_SAMPLE_FMT_FLTP, .sample_fmts = (const enum AVSampleFormat[]) { AV_SAMPLE_FMT_FLTP,
AV_SAMPLE_FMT_NONE }, AV_SAMPLE_FMT_NONE },
.caps_internal = FF_CODEC_CAP_INIT_CLEANUP,
}; };
#endif #endif

Loading…
Cancel
Save