diff mbox

[FFmpeg-devel] avformat/matroskadec: fix resource leak

Message ID 20170505200603.10793-1-lq@chinaffmpeg.org
State Accepted
Commit cc25a887c5467be5c7b004665047a32d36c9cf42
Headers show

Commit Message

Liu Steven May 5, 2017, 8:06 p.m. UTC
Fixes Coverity CID: 1405453

Signed-off-by: Steven Liu <lq@chinaffmpeg.org>
---
 libavformat/matroskadec.c |    1 +
 1 files changed, 1 insertions(+), 0 deletions(-)

Comments

wm4 May 5, 2017, 12:20 p.m. UTC | #1
On Sat,  6 May 2017 04:06:03 +0800
Steven Liu <lq@chinaffmpeg.org> wrote:

> Fixes Coverity CID: 1405453
> 
> Signed-off-by: Steven Liu <lq@chinaffmpeg.org>
> ---
>  libavformat/matroskadec.c |    1 +
>  1 files changed, 1 insertions(+), 0 deletions(-)
> 
> diff --git a/libavformat/matroskadec.c b/libavformat/matroskadec.c
> index 9e2c9bd..5282ef7 100644
> --- a/libavformat/matroskadec.c
> +++ b/libavformat/matroskadec.c
> @@ -3893,6 +3893,7 @@ static int webm_dash_manifest_cues(AVFormatContext *s, int64_t init_range)
>                             "%" PRId64, s->streams[0]->index_entries[i].timestamp);
>          if (ret <= 0 || (ret == 20 && i ==  s->streams[0]->nb_index_entries - 1)) {
>              av_log(s, AV_LOG_ERROR, "timestamp too long.\n");
> +            av_free(buf);
>              return AVERROR_INVALIDDATA;
>          }
>          end += ret;

LGTM
Steven Liu May 7, 2017, 4:07 p.m. UTC | #2
2017-05-05 20:20 GMT+08:00 wm4 <nfxjfg@googlemail.com>:

> On Sat,  6 May 2017 04:06:03 +0800
> Steven Liu <lq@chinaffmpeg.org> wrote:
>
> > Fixes Coverity CID: 1405453
> >
> > Signed-off-by: Steven Liu <lq@chinaffmpeg.org>
> > ---
> >  libavformat/matroskadec.c |    1 +
> >  1 files changed, 1 insertions(+), 0 deletions(-)
> >
> > diff --git a/libavformat/matroskadec.c b/libavformat/matroskadec.c
> > index 9e2c9bd..5282ef7 100644
> > --- a/libavformat/matroskadec.c
> > +++ b/libavformat/matroskadec.c
> > @@ -3893,6 +3893,7 @@ static int webm_dash_manifest_cues(AVFormatContext
> *s, int64_t init_range)
> >                             "%" PRId64, s->streams[0]->index_entries[
> i].timestamp);
> >          if (ret <= 0 || (ret == 20 && i ==  s->streams[0]->nb_index_entries
> - 1)) {
> >              av_log(s, AV_LOG_ERROR, "timestamp too long.\n");
> > +            av_free(buf);
> >              return AVERROR_INVALIDDATA;
> >          }
> >          end += ret;
>
> LGTM
> _______________________________________________
> ffmpeg-devel mailing list
> ffmpeg-devel@ffmpeg.org
> http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
>

Applied!

Thanks
diff mbox

Patch

diff --git a/libavformat/matroskadec.c b/libavformat/matroskadec.c
index 9e2c9bd..5282ef7 100644
--- a/libavformat/matroskadec.c
+++ b/libavformat/matroskadec.c
@@ -3893,6 +3893,7 @@  static int webm_dash_manifest_cues(AVFormatContext *s, int64_t init_range)
                            "%" PRId64, s->streams[0]->index_entries[i].timestamp);
         if (ret <= 0 || (ret == 20 && i ==  s->streams[0]->nb_index_entries - 1)) {
             av_log(s, AV_LOG_ERROR, "timestamp too long.\n");
+            av_free(buf);
             return AVERROR_INVALIDDATA;
         }
         end += ret;