diff mbox series

[FFmpeg-devel] avcodec/codec_par: do not copy AVChannelLayout struct directly

Message ID 20220315142848.30527-1-cus@passwd.hu
State Accepted
Commit ef2b3efd5153568989324f01de41ca19bf3afda1
Headers show
Series [FFmpeg-devel] avcodec/codec_par: do not copy AVChannelLayout struct directly | expand

Checks

Context Check Description
yinshiyou/make_loongarch64 success Make finished
yinshiyou/make_fate_loongarch64 success Make fate finished
andriy/make_x86 success Make finished
andriy/make_fate_x86 success Make fate finished
andriy/make_aarch64_jetson success Make finished
andriy/make_fate_aarch64_jetson success Make fate finished
andriy/make_armv7_RPi4 success Make finished
andriy/make_fate_armv7_RPi4 success Make fate finished

Commit Message

Marton Balint March 15, 2022, 2:28 p.m. UTC
Later we use av_channel_layout_copy, but that uninits the struct
unintentionally freeing the possibly allocated u.map pointer.

Signed-off-by: Marton Balint <cus@passwd.hu>
---
 libavcodec/codec_par.c | 1 +
 1 file changed, 1 insertion(+)

Comments

James Almer March 15, 2022, 3:10 p.m. UTC | #1
On 3/15/2022 11:28 AM, Marton Balint wrote:
> Later we use av_channel_layout_copy, but that uninits the struct
> unintentionally freeing the possibly allocated u.map pointer.
> 
> Signed-off-by: Marton Balint <cus@passwd.hu>
> ---
>   libavcodec/codec_par.c | 1 +
>   1 file changed, 1 insertion(+)
> 
> diff --git a/libavcodec/codec_par.c b/libavcodec/codec_par.c
> index e4b329c838..abda649aa8 100644
> --- a/libavcodec/codec_par.c
> +++ b/libavcodec/codec_par.c
> @@ -78,6 +78,7 @@ int avcodec_parameters_copy(AVCodecParameters *dst, const AVCodecParameters *src
>       codec_parameters_reset(dst);
>       memcpy(dst, src, sizeof(*dst));
>   
> +    dst->ch_layout      = (AVChannelLayout){0};
>       dst->extradata      = NULL;
>       dst->extradata_size = 0;
>       if (src->extradata) {

LGTM.
diff mbox series

Patch

diff --git a/libavcodec/codec_par.c b/libavcodec/codec_par.c
index e4b329c838..abda649aa8 100644
--- a/libavcodec/codec_par.c
+++ b/libavcodec/codec_par.c
@@ -78,6 +78,7 @@  int avcodec_parameters_copy(AVCodecParameters *dst, const AVCodecParameters *src
     codec_parameters_reset(dst);
     memcpy(dst, src, sizeof(*dst));
 
+    dst->ch_layout      = (AVChannelLayout){0};
     dst->extradata      = NULL;
     dst->extradata_size = 0;
     if (src->extradata) {