diff mbox

[FFmpeg-devel,05/11] avformat/pcmdec: fix memory leak

Message ID 20170611140551.11844-5-timo@rothenpieler.org
State Accepted
Commit a5b5ce2658bf7506bb31f0b2b4cb44ddbf9a3955
Headers show

Commit Message

Timo Rothenpieler June 11, 2017, 2:05 p.m. UTC
Fixes CID 1396267
---
 libavformat/pcmdec.c | 2 ++
 1 file changed, 2 insertions(+)

Comments

Paul B Mahol June 11, 2017, 5:07 p.m. UTC | #1
On 6/11/17, Timo Rothenpieler <timo@rothenpieler.org> wrote:
> Fixes CID 1396267
> ---
>  libavformat/pcmdec.c | 2 ++
>  1 file changed, 2 insertions(+)
>
> diff --git a/libavformat/pcmdec.c b/libavformat/pcmdec.c
> index 3c7e8ac84b..d0ceea6fa9 100644
> --- a/libavformat/pcmdec.c
> +++ b/libavformat/pcmdec.c
> @@ -68,6 +68,7 @@ static int pcm_read_header(AVFormatContext *s)
>                  av_log(s, AV_LOG_ERROR,
>                         "Invalid sample_rate found in mime_type \"%s\"\n",
>                         mime_type);
> +                av_freep(&mime_type);
>                  return AVERROR_INVALIDDATA;
>              }
>              st->codecpar->sample_rate = rate;
> @@ -75,6 +76,7 @@ static int pcm_read_header(AVFormatContext *s)
>                  st->codecpar->channels = channels;
>          }
>      }
> +    av_freep(&mime_type);
>
>      st->codecpar->bits_per_coded_sample =
>          av_get_bits_per_sample(st->codecpar->codec_id);
> --
> 2.13.0
>
> _______________________________________________
> ffmpeg-devel mailing list
> ffmpeg-devel@ffmpeg.org
> http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
>

lgtm
Timo Rothenpieler June 13, 2017, 5:54 p.m. UTC | #2
Am 11.06.2017 um 19:07 schrieb Paul B Mahol:
> On 6/11/17, Timo Rothenpieler <timo@rothenpieler.org> wrote:
>> Fixes CID 1396267
>> ---
>>   libavformat/pcmdec.c | 2 ++
>>   1 file changed, 2 insertions(+)
>>
>> diff --git a/libavformat/pcmdec.c b/libavformat/pcmdec.c
>> index 3c7e8ac84b..d0ceea6fa9 100644
>> --- a/libavformat/pcmdec.c
>> +++ b/libavformat/pcmdec.c
>> @@ -68,6 +68,7 @@ static int pcm_read_header(AVFormatContext *s)
>>                   av_log(s, AV_LOG_ERROR,
>>                          "Invalid sample_rate found in mime_type \"%s\"\n",
>>                          mime_type);
>> +                av_freep(&mime_type);
>>                   return AVERROR_INVALIDDATA;
>>               }
>>               st->codecpar->sample_rate = rate;
>> @@ -75,6 +76,7 @@ static int pcm_read_header(AVFormatContext *s)
>>                   st->codecpar->channels = channels;
>>           }
>>       }
>> +    av_freep(&mime_type);
>>
>>       st->codecpar->bits_per_coded_sample =
>>           av_get_bits_per_sample(st->codecpar->codec_id);
>> --
>> 2.13.0
>>
>> _______________________________________________
>> ffmpeg-devel mailing list
>> ffmpeg-devel@ffmpeg.org
>> http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
>>
> 
> lgtm

applied
diff mbox

Patch

diff --git a/libavformat/pcmdec.c b/libavformat/pcmdec.c
index 3c7e8ac84b..d0ceea6fa9 100644
--- a/libavformat/pcmdec.c
+++ b/libavformat/pcmdec.c
@@ -68,6 +68,7 @@  static int pcm_read_header(AVFormatContext *s)
                 av_log(s, AV_LOG_ERROR,
                        "Invalid sample_rate found in mime_type \"%s\"\n",
                        mime_type);
+                av_freep(&mime_type);
                 return AVERROR_INVALIDDATA;
             }
             st->codecpar->sample_rate = rate;
@@ -75,6 +76,7 @@  static int pcm_read_header(AVFormatContext *s)
                 st->codecpar->channels = channels;
         }
     }
+    av_freep(&mime_type);
 
     st->codecpar->bits_per_coded_sample =
         av_get_bits_per_sample(st->codecpar->codec_id);