diff mbox series

[FFmpeg-devel,01/17] avcodec/avcodec: Uninitialize AVChannelLayout before overwriting it

Message ID GV1P250MB07378D20BA2B5BB1370634B18F4A9@GV1P250MB0737.EURP250.PROD.OUTLOOK.COM
State Accepted
Commit e2e31815191254ef5581213639f4bed8e4a8be25
Headers show
Series [FFmpeg-devel,01/17] avcodec/avcodec: Uninitialize AVChannelLayout before overwriting it | 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

Commit Message

Andreas Rheinhardt Sept. 18, 2022, 8:15 p.m. UTC
Otherwise, there might be leaks.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
---
 libavcodec/avcodec.c | 1 +
 1 file changed, 1 insertion(+)

Comments

Andreas Rheinhardt Sept. 20, 2022, 10:15 p.m. UTC | #1
Andreas Rheinhardt:
> Otherwise, there might be leaks.
> 
> Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
> ---
>  libavcodec/avcodec.c | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/libavcodec/avcodec.c b/libavcodec/avcodec.c
> index 29643199be..a165cdea95 100644
> --- a/libavcodec/avcodec.c
> +++ b/libavcodec/avcodec.c
> @@ -235,6 +235,7 @@ FF_DISABLE_DEPRECATION_WARNINGS
>      if ((avctx->channels > 0 && avctx->ch_layout.nb_channels != avctx->channels) ||
>          (avctx->channel_layout && (avctx->ch_layout.order != AV_CHANNEL_ORDER_NATIVE ||
>                                     avctx->ch_layout.u.mask != avctx->channel_layout))) {
> +        av_channel_layout_uninit(&avctx->ch_layout);
>          if (avctx->channel_layout) {
>              av_channel_layout_from_mask(&avctx->ch_layout, avctx->channel_layout);
>          } else {

Will apply this patchset tomorrow unless there are objections.

- Andreas
diff mbox series

Patch

diff --git a/libavcodec/avcodec.c b/libavcodec/avcodec.c
index 29643199be..a165cdea95 100644
--- a/libavcodec/avcodec.c
+++ b/libavcodec/avcodec.c
@@ -235,6 +235,7 @@  FF_DISABLE_DEPRECATION_WARNINGS
     if ((avctx->channels > 0 && avctx->ch_layout.nb_channels != avctx->channels) ||
         (avctx->channel_layout && (avctx->ch_layout.order != AV_CHANNEL_ORDER_NATIVE ||
                                    avctx->ch_layout.u.mask != avctx->channel_layout))) {
+        av_channel_layout_uninit(&avctx->ch_layout);
         if (avctx->channel_layout) {
             av_channel_layout_from_mask(&avctx->ch_layout, avctx->channel_layout);
         } else {