mirror of
https://git.ffmpeg.org/ffmpeg.git
synced 2026-06-16 04:32:47 +02:00
avcodec/sonic: Fix leaks upon allocation errors
The Sonic decoder and encoders allocate several buffers in their init
function and return immediately if one of these allocations fails; this
will lead to leaks if there was an earlier successfull allocation. Fix
this by setting the FF_CODEC_CAP_INIT_CLEANUP flag.
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
(cherry picked from commit 7d91f9271e)
This commit is contained in:
@@ -1096,6 +1096,7 @@ AVCodec ff_sonic_decoder = {
|
||||
.close = sonic_decode_close,
|
||||
.decode = sonic_decode_frame,
|
||||
.capabilities = AV_CODEC_CAP_DR1 | AV_CODEC_CAP_EXPERIMENTAL,
|
||||
.caps_internal = FF_CODEC_CAP_INIT_CLEANUP,
|
||||
};
|
||||
#endif /* CONFIG_SONIC_DECODER */
|
||||
|
||||
@@ -1110,6 +1111,7 @@ AVCodec ff_sonic_encoder = {
|
||||
.encode2 = sonic_encode_frame,
|
||||
.sample_fmts = (const enum AVSampleFormat[]){ AV_SAMPLE_FMT_S16, AV_SAMPLE_FMT_NONE },
|
||||
.capabilities = AV_CODEC_CAP_EXPERIMENTAL,
|
||||
.caps_internal = FF_CODEC_CAP_INIT_CLEANUP,
|
||||
.close = sonic_encode_close,
|
||||
};
|
||||
#endif
|
||||
@@ -1125,6 +1127,7 @@ AVCodec ff_sonic_ls_encoder = {
|
||||
.encode2 = sonic_encode_frame,
|
||||
.sample_fmts = (const enum AVSampleFormat[]){ AV_SAMPLE_FMT_S16, AV_SAMPLE_FMT_NONE },
|
||||
.capabilities = AV_CODEC_CAP_EXPERIMENTAL,
|
||||
.caps_internal = FF_CODEC_CAP_INIT_CLEANUP,
|
||||
.close = sonic_encode_close,
|
||||
};
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user