diff mbox

[FFmpeg-devel,v2,5/8] avformat/rtmpproto: fix memleak when open rtmp failed

Message ID 20191010020756.30820-5-lq@chinaffmpeg.org
State New
Headers show

Commit Message

Steven Liu Oct. 10, 2019, 2:07 a.m. UTC
Signed-off-by: Steven Liu <lq@chinaffmpeg.org>
---
 libavformat/rtmpproto.c | 3 +++
 1 file changed, 3 insertions(+)

Comments

Lance Wang Oct. 10, 2019, 2:16 a.m. UTC | #1
On Thu, Oct 10, 2019 at 10:07:53AM +0800, Steven Liu wrote:
> Signed-off-by: Steven Liu <lq@chinaffmpeg.org>
> ---
>  libavformat/rtmpproto.c | 3 +++
>  1 file changed, 3 insertions(+)
> 
> diff --git a/libavformat/rtmpproto.c b/libavformat/rtmpproto.c
> index eb08d4d424..688a740b87 100644
> --- a/libavformat/rtmpproto.c
> +++ b/libavformat/rtmpproto.c
> @@ -2880,6 +2880,9 @@ reconnect:
>      return 0;
>  
>  fail:
> +    av_free(&rt->playpath);
> +    av_free(&rt->tcurl);
> +    av_free(&rt->flashver);

it's av_freep

>      av_dict_free(opts);
>      rtmp_close(s);
>      return ret;
> -- 
> 2.15.1
> 
> 
> 
> 
> _______________________________________________
> ffmpeg-devel mailing list
> ffmpeg-devel@ffmpeg.org
> https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
> 
> To unsubscribe, visit link above, or email
> ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".
Steven Liu Oct. 10, 2019, 2:20 a.m. UTC | #2
> 在 2019年10月10日,10:16,Limin Wang <lance.lmwang@gmail.com> 写道:
> 
> On Thu, Oct 10, 2019 at 10:07:53AM +0800, Steven Liu wrote:
>> Signed-off-by: Steven Liu <lq@chinaffmpeg.org>
>> ---
>> libavformat/rtmpproto.c | 3 +++
>> 1 file changed, 3 insertions(+)
>> 
>> diff --git a/libavformat/rtmpproto.c b/libavformat/rtmpproto.c
>> index eb08d4d424..688a740b87 100644
>> --- a/libavformat/rtmpproto.c
>> +++ b/libavformat/rtmpproto.c
>> @@ -2880,6 +2880,9 @@ reconnect:
>>     return 0;
>> 
>> fail:
>> +    av_free(&rt->playpath);
>> +    av_free(&rt->tcurl);
>> +    av_free(&rt->flashver);
> 
> it's av_freep
fixed locally
> 
>>     av_dict_free(opts);
>>     rtmp_close(s);
>>     return ret;
>> -- 
>> 2.15.1
>> 
>> 
>> 
>> 
>> _______________________________________________
>> ffmpeg-devel mailing list
>> ffmpeg-devel@ffmpeg.org
>> https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
>> 
>> To unsubscribe, visit link above, or email
>> ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".
> _______________________________________________
> ffmpeg-devel mailing list
> ffmpeg-devel@ffmpeg.org
> https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
> 
> To unsubscribe, visit link above, or email
> ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".

Thanks
Steven
diff mbox

Patch

diff --git a/libavformat/rtmpproto.c b/libavformat/rtmpproto.c
index eb08d4d424..688a740b87 100644
--- a/libavformat/rtmpproto.c
+++ b/libavformat/rtmpproto.c
@@ -2880,6 +2880,9 @@  reconnect:
     return 0;
 
 fail:
+    av_free(&rt->playpath);
+    av_free(&rt->tcurl);
+    av_free(&rt->flashver);
     av_dict_free(opts);
     rtmp_close(s);
     return ret;