Re: [FFmpeg-devel] [PATCH] avformat/utils: fix memory leak in avformat_free_context

2017-08-03 Thread Steven Siloti
On Mon, Jul 31, 2017 at 11:08 AM, Steven Siloti <ssil...@bittorrent.com>
wrote:

> The pointer to the packet queue is stored in the internal structure
> so the queue needs to be flushed before internal is freed.
>
> Signed-off-by: Steven Siloti <ssil...@bittorrent.com>
> ---
>  libavformat/utils.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/libavformat/utils.c b/libavformat/utils.c
> index 38d247c6cd..58283616dc 100644
> --- a/libavformat/utils.c
> +++ b/libavformat/utils.c
> @@ -4333,8 +4333,8 @@ void avformat_free_context(AVFormatContext *s)
>  av_dict_free(>metadata);
>  av_dict_free(>internal->id3v2_meta);
>  av_freep(>streams);
> -av_freep(>internal);
>  flush_packet_queue(s);
> +av_freep(>internal);
>  av_free(s);
>  }
>
> --
> 2.13.0.windows.1
>
> Is there something wrong with this patch? It seems like a straightforward
fix to me. Perhaps you would prefer it as an attachment. If so, attached.


0001-avformat-utils-fix-memory-leak-in-avformat_free_cont.patch
Description: Binary data
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


[FFmpeg-devel] [PATCH] avformat/utils: fix memory leak in avformat_free_context

2017-07-31 Thread Steven Siloti
The pointer to the packet queue is stored in the internal structure
so the queue needs to be flushed before internal is freed.

Signed-off-by: Steven Siloti <ssil...@bittorrent.com>
---
 libavformat/utils.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/libavformat/utils.c b/libavformat/utils.c
index 38d247c6cd..58283616dc 100644
--- a/libavformat/utils.c
+++ b/libavformat/utils.c
@@ -4333,8 +4333,8 @@ void avformat_free_context(AVFormatContext *s)
 av_dict_free(>metadata);
 av_dict_free(>internal->id3v2_meta);
 av_freep(>streams);
-av_freep(>internal);
 flush_packet_queue(s);
+av_freep(>internal);
 av_free(s);
 }
 
-- 
2.13.0.windows.1

___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


[FFmpeg-devel] [PATCH] avformat/utils: fix freeing packet queue in avformat_free_context

2017-07-18 Thread Steven Siloti
The packet queue is referenced in internal so it needs to be flushed
before the internal structure is freed.

Signed-off-by: Steven Siloti <ssil...@bittorrent.com>
---
 libavformat/utils.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/libavformat/utils.c b/libavformat/utils.c
index 38d247c6cd..58283616dc 100644
--- a/libavformat/utils.c
+++ b/libavformat/utils.c
@@ -4333,8 +4333,8 @@ void avformat_free_context(AVFormatContext *s)
 av_dict_free(>metadata);
 av_dict_free(>internal->id3v2_meta);
 av_freep(>streams);
-av_freep(>internal);
 flush_packet_queue(s);
+av_freep(>internal);
 av_free(s);
 }
 
-- 
2.13.0.windows.1

___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel