[FFmpeg-devel,2/3] lavf/vividas: free the PB when get EOF

Submitted by Jun Zhao on Nov. 28, 2019, 1:40 p.m.

Details

Message ID 1574948460-15981-2-git-send-email-mypopydev@gmail.com
State New
Headers show

Commit Message

Jun Zhao Nov. 28, 2019, 1:40 p.m.
From: Jun Zhao <barryjzhao@tencent.com>

free the PB when get EOF.

Signed-off-by: Jun Zhao <barryjzhao@tencent.com>
---
 libavformat/vividas.c |    4 +++-
 1 files changed, 3 insertions(+), 1 deletions(-)

Comments

Andriy Gelman Nov. 28, 2019, 1:53 p.m.
On Thu, 28. Nov 21:40, Jun Zhao wrote:
> From: Jun Zhao <barryjzhao@tencent.com>
> 
> free the PB when get EOF.
> 
> Signed-off-by: Jun Zhao <barryjzhao@tencent.com>
> ---
>  libavformat/vividas.c |    4 +++-
>  1 files changed, 3 insertions(+), 1 deletions(-)
> 
> diff --git a/libavformat/vividas.c b/libavformat/vividas.c
> index 16642c0..f354d7d 100644
> --- a/libavformat/vividas.c
> +++ b/libavformat/vividas.c
> @@ -296,8 +296,10 @@ static int track_header(VividasDemuxContext *viv, AVFormatContext *s,  uint8_t *
>      for (i=0;i<val_1;i++) {
>          int c = avio_r8(pb);
>          for (j=0;j<c;j++) {
> -            if (avio_feof(pb))
> +            if (avio_feof(pb)) {
> +                av_free(pb);
>                  return AVERROR_EOF;
> +            }
>              avio_r8(pb); // val_3
>              avio_r8(pb); // val_4
>          }

I think Michael posted same patch recently
http://ffmpeg.org/pipermail/ffmpeg-devel/2019-November/253390.html

Patch hide | download patch | download mbox

diff --git a/libavformat/vividas.c b/libavformat/vividas.c
index 16642c0..f354d7d 100644
--- a/libavformat/vividas.c
+++ b/libavformat/vividas.c
@@ -296,8 +296,10 @@  static int track_header(VividasDemuxContext *viv, AVFormatContext *s,  uint8_t *
     for (i=0;i<val_1;i++) {
         int c = avio_r8(pb);
         for (j=0;j<c;j++) {
-            if (avio_feof(pb))
+            if (avio_feof(pb)) {
+                av_free(pb);
                 return AVERROR_EOF;
+            }
             avio_r8(pb); // val_3
             avio_r8(pb); // val_4
         }