Re: [FFmpeg-devel] [PATCH] ffplay: fix mem leak when opening input or parsing options fail.

2014-11-22 Thread Marton Balint



On Fri, 21 Nov 2014, Benoit Fouet wrote:


---
ffplay.c | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/ffplay.c b/ffplay.c
index f79161d..1914a66 100644
--- a/ffplay.c
+++ b/ffplay.c
@@ -3169,8 +3169,9 @@ static int read_thread(void *arg)
stream_component_close(is, is-video_stream);
if (is-subtitle_stream = 0)
stream_component_close(is, is-subtitle_stream);
-if (is-ic) {
-avformat_close_input(is-ic);
+if (ic) {
+avformat_close_input(ic);
+is-ic = NULL;
}

if (ret != 0) {
--
2.2.0.rc2.23.gca0107e


LGTM, altough if avformat_open_input fails, it frees the context according 
to docs, so I guess this is only really needed for the option parsing 
failure.


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


[FFmpeg-devel] [PATCH] ffplay: fix mem leak when opening input or parsing options fail.

2014-11-21 Thread Benoit Fouet
---
 ffplay.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/ffplay.c b/ffplay.c
index f79161d..1914a66 100644
--- a/ffplay.c
+++ b/ffplay.c
@@ -3169,8 +3169,9 @@ static int read_thread(void *arg)
 stream_component_close(is, is-video_stream);
 if (is-subtitle_stream = 0)
 stream_component_close(is, is-subtitle_stream);
-if (is-ic) {
-avformat_close_input(is-ic);
+if (ic) {
+avformat_close_input(ic);
+is-ic = NULL;
 }
 
 if (ret != 0) {
-- 
2.2.0.rc2.23.gca0107e

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


[FFmpeg-devel] [PATCH] ffplay: fix mem leak when opening input or parsing options fail.

2014-11-20 Thread Benoit Fouet
---
 ffplay.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/ffplay.c b/ffplay.c
index f79161d..3009c82 100644
--- a/ffplay.c
+++ b/ffplay.c
@@ -3169,8 +3169,8 @@ static int read_thread(void *arg)
 stream_component_close(is, is-video_stream);
 if (is-subtitle_stream = 0)
 stream_component_close(is, is-subtitle_stream);
-if (is-ic) {
-avformat_close_input(is-ic);
+if (ic) {
+avformat_close_input(ic);
 }
 
 if (ret != 0) {
-- 
2.2.0.rc2.23.gca0107e

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


Re: [FFmpeg-devel] [PATCH] ffplay: fix mem leak when opening input or parsing options fail.

2014-11-20 Thread Michael Niedermayer
On Thu, Nov 20, 2014 at 04:01:27PM +0100, Benoit Fouet wrote:
 ---
  ffplay.c | 4 ++--
  1 file changed, 2 insertions(+), 2 deletions(-)
 
 diff --git a/ffplay.c b/ffplay.c
 index f79161d..3009c82 100644
 --- a/ffplay.c
 +++ b/ffplay.c
 @@ -3169,8 +3169,8 @@ static int read_thread(void *arg)
  stream_component_close(is, is-video_stream);
  if (is-subtitle_stream = 0)
  stream_component_close(is, is-subtitle_stream);
 -if (is-ic) {
 -avformat_close_input(is-ic);
 +if (ic) {
 +avformat_close_input(ic);

is-ic should be set to NULL i think
avformat_close_input did that previously

[...]
-- 
Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

You can kill me, but you cannot change the truth.


signature.asc
Description: Digital signature
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel