On Thu, Apr 4, 2019 at 11:25 AM Jun Zhao <mypopy...@gmail.com> wrote:
>
> From: Jun Zhao <barryjz...@tencent.com>
>
> Fix memory leak after write trailer for #7827
>
> Signed-off-by: Jun Zhao <barryjz...@tencent.com>
> ---
>  libavformat/matroskaenc.c |    2 +-
>  1 files changed, 1 insertions(+), 1 deletions(-)
>
> diff --git a/libavformat/matroskaenc.c b/libavformat/matroskaenc.c
> index b9f99c4..22ba93a 100644
> --- a/libavformat/matroskaenc.c
> +++ b/libavformat/matroskaenc.c
> @@ -2571,13 +2571,13 @@ static int mkv_write_trailer(AVFormatContext *s)
>      // check if we have an audio packet cached
>      if (mkv->cur_audio_pkt.size > 0) {
>          ret = mkv_write_packet_internal(s, &mkv->cur_audio_pkt, 0);
> -        av_packet_unref(&mkv->cur_audio_pkt);
>          if (ret < 0) {
>              av_log(s, AV_LOG_ERROR,
>                     "Could not write cached audio packet ret:%d\n", ret);
>              return ret;
>          }
>      }
> +    av_packet_unref(&mkv->cur_audio_pkt);
>

Won't this leak instead when the error path above is triggered?
Also, whats in the packet if it has a size of 0?

- Hendrik
_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".

Reply via email to