Re: [FFmpeg-devel] [PATCH 2/2] lavc/options: fix leaks in avcodec_copy_context

2014-12-05 Thread Lukasz Marek

On 04.12.2014 23:51, Michael Niedermayer wrote:

On Thu, Dec 04, 2014 at 12:54:30AM +0100, Lukasz Marek wrote:

On 27.11.2014 04:17, Michael Niedermayer wrote:

On Thu, Nov 27, 2014 at 12:43:57AM +0100, Lukasz Marek wrote:

On 24.11.2014 05:16, Lukasz Marek wrote:

Signed-off-by: Lukasz Marek lukasz.m.lu...@gmail.com
---
  libavcodec/options.c | 23 +++
  1 file changed, 11 insertions(+), 12 deletions(-)

diff --git a/libavcodec/options.c b/libavcodec/options.c
index 7f9fb07..8ba997c 100644
--- a/libavcodec/options.c
+++ b/libavcodec/options.c
@@ -190,6 +190,11 @@ int avcodec_copy_context(AVCodecContext *dest, const 
AVCodecContext *src)
  }

  av_opt_free(dest);
+av_freep(dest-rc_override);
+av_freep(dest-intra_matrix);
+av_freep(dest-inter_matrix);
+av_freep(dest-extradata);
+av_freep(dest-subtitle_header);

  memcpy(dest, src, sizeof(*dest));
  av_opt_copy(dest, src);
@@ -205,13 +210,7 @@ int avcodec_copy_context(AVCodecContext *dest, const 
AVCodecContext *src)
  dest-slice_offset= NULL;
  dest-hwaccel = NULL;
  dest-internal= NULL;
-
-/* reallocate values that should be allocated separately */
-dest-extradata   = NULL;
-dest-intra_matrix= NULL;
-dest-inter_matrix= NULL;
-dest-rc_override = NULL;
-dest-subtitle_header = NULL;



This should stay. Updated version attched




  options.c |   16 +++-
  1 file changed, 11 insertions(+), 5 deletions(-)
971d1769e50d2e853d7359003f8c924092a96e6b  
0001-lavc-options-fix-leaks-in-avcodec_copy_context.patch
 From 722d7e837093212d6e6e6b17814ed408300d25a6 Mon Sep 17 00:00:00 2001
From: Lukasz Marek lukasz.m.lu...@gmail.com
Date: Thu, 27 Nov 2014 00:41:16 +0100
Subject: [PATCH] lavc/options: fix leaks in avcodec_copy_context

Signed-off-by: Lukasz Marek lukasz.m.lu...@gmail.com
---
  libavcodec/options.c | 16 +++-
  1 file changed, 11 insertions(+), 5 deletions(-)


breaks make fate-lavf-yuv4mpeg

--- ./tests/ref/lavf/yuv4mpeg   2014-11-26 20:04:48.466295490 +0100
+++ tests/data/fate/lavf-yuv4mpeg   2014-11-27 04:16:07.234916526 +0100
@@ -1,2 +0,0 @@
-ec8178cb152f9cdbfd9cb724d977db2e *./tests/data/lavf/lavf.y4m
-3801808 ./tests/data/lavf/lavf.y4m
Test lavf-yuv4mpeg failed. Look at tests/data/fate/lavf-yuv4mpeg.err for 
details.
make: *** [fate-lavf-yuv4mpeg] Error 139


I will rerun whole fate, but I assume I can push it if nothing fails?
The one mentioned above is OK.


ok


pushed

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


Re: [FFmpeg-devel] [PATCH 2/2] lavc/options: fix leaks in avcodec_copy_context

2014-12-04 Thread Michael Niedermayer
On Thu, Dec 04, 2014 at 12:54:30AM +0100, Lukasz Marek wrote:
 On 27.11.2014 04:17, Michael Niedermayer wrote:
 On Thu, Nov 27, 2014 at 12:43:57AM +0100, Lukasz Marek wrote:
 On 24.11.2014 05:16, Lukasz Marek wrote:
 Signed-off-by: Lukasz Marek lukasz.m.lu...@gmail.com
 ---
   libavcodec/options.c | 23 +++
   1 file changed, 11 insertions(+), 12 deletions(-)
 
 diff --git a/libavcodec/options.c b/libavcodec/options.c
 index 7f9fb07..8ba997c 100644
 --- a/libavcodec/options.c
 +++ b/libavcodec/options.c
 @@ -190,6 +190,11 @@ int avcodec_copy_context(AVCodecContext *dest, const 
 AVCodecContext *src)
   }
 
   av_opt_free(dest);
 +av_freep(dest-rc_override);
 +av_freep(dest-intra_matrix);
 +av_freep(dest-inter_matrix);
 +av_freep(dest-extradata);
 +av_freep(dest-subtitle_header);
 
   memcpy(dest, src, sizeof(*dest));
   av_opt_copy(dest, src);
 @@ -205,13 +210,7 @@ int avcodec_copy_context(AVCodecContext *dest, const 
 AVCodecContext *src)
   dest-slice_offset= NULL;
   dest-hwaccel = NULL;
   dest-internal= NULL;
 -
 -/* reallocate values that should be allocated separately */
 -dest-extradata   = NULL;
 -dest-intra_matrix= NULL;
 -dest-inter_matrix= NULL;
 -dest-rc_override = NULL;
 -dest-subtitle_header = NULL;
 
 
 This should stay. Updated version attched
 
 
   options.c |   16 +++-
   1 file changed, 11 insertions(+), 5 deletions(-)
 971d1769e50d2e853d7359003f8c924092a96e6b  
 0001-lavc-options-fix-leaks-in-avcodec_copy_context.patch
  From 722d7e837093212d6e6e6b17814ed408300d25a6 Mon Sep 17 00:00:00 2001
 From: Lukasz Marek lukasz.m.lu...@gmail.com
 Date: Thu, 27 Nov 2014 00:41:16 +0100
 Subject: [PATCH] lavc/options: fix leaks in avcodec_copy_context
 
 Signed-off-by: Lukasz Marek lukasz.m.lu...@gmail.com
 ---
   libavcodec/options.c | 16 +++-
   1 file changed, 11 insertions(+), 5 deletions(-)
 
 breaks make fate-lavf-yuv4mpeg
 
 --- ./tests/ref/lavf/yuv4mpeg   2014-11-26 20:04:48.466295490 +0100
 +++ tests/data/fate/lavf-yuv4mpeg   2014-11-27 04:16:07.234916526 +0100
 @@ -1,2 +0,0 @@
 -ec8178cb152f9cdbfd9cb724d977db2e *./tests/data/lavf/lavf.y4m
 -3801808 ./tests/data/lavf/lavf.y4m
 Test lavf-yuv4mpeg failed. Look at tests/data/fate/lavf-yuv4mpeg.err for 
 details.
 make: *** [fate-lavf-yuv4mpeg] Error 139
 
 I will rerun whole fate, but I assume I can push it if nothing fails?
 The one mentioned above is OK.

ok

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

Asymptotically faster algorithms should always be preferred if you have
asymptotical amounts of data


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


Re: [FFmpeg-devel] [PATCH 2/2] lavc/options: fix leaks in avcodec_copy_context

2014-12-03 Thread Lukasz Marek

On 27.11.2014 04:17, Michael Niedermayer wrote:

On Thu, Nov 27, 2014 at 12:43:57AM +0100, Lukasz Marek wrote:

On 24.11.2014 05:16, Lukasz Marek wrote:

Signed-off-by: Lukasz Marek lukasz.m.lu...@gmail.com
---
  libavcodec/options.c | 23 +++
  1 file changed, 11 insertions(+), 12 deletions(-)

diff --git a/libavcodec/options.c b/libavcodec/options.c
index 7f9fb07..8ba997c 100644
--- a/libavcodec/options.c
+++ b/libavcodec/options.c
@@ -190,6 +190,11 @@ int avcodec_copy_context(AVCodecContext *dest, const 
AVCodecContext *src)
  }

  av_opt_free(dest);
+av_freep(dest-rc_override);
+av_freep(dest-intra_matrix);
+av_freep(dest-inter_matrix);
+av_freep(dest-extradata);
+av_freep(dest-subtitle_header);

  memcpy(dest, src, sizeof(*dest));
  av_opt_copy(dest, src);
@@ -205,13 +210,7 @@ int avcodec_copy_context(AVCodecContext *dest, const 
AVCodecContext *src)
  dest-slice_offset= NULL;
  dest-hwaccel = NULL;
  dest-internal= NULL;
-
-/* reallocate values that should be allocated separately */
-dest-extradata   = NULL;
-dest-intra_matrix= NULL;
-dest-inter_matrix= NULL;
-dest-rc_override = NULL;
-dest-subtitle_header = NULL;



This should stay. Updated version attched




  options.c |   16 +++-
  1 file changed, 11 insertions(+), 5 deletions(-)
971d1769e50d2e853d7359003f8c924092a96e6b  
0001-lavc-options-fix-leaks-in-avcodec_copy_context.patch
 From 722d7e837093212d6e6e6b17814ed408300d25a6 Mon Sep 17 00:00:00 2001
From: Lukasz Marek lukasz.m.lu...@gmail.com
Date: Thu, 27 Nov 2014 00:41:16 +0100
Subject: [PATCH] lavc/options: fix leaks in avcodec_copy_context

Signed-off-by: Lukasz Marek lukasz.m.lu...@gmail.com
---
  libavcodec/options.c | 16 +++-
  1 file changed, 11 insertions(+), 5 deletions(-)


breaks make fate-lavf-yuv4mpeg

--- ./tests/ref/lavf/yuv4mpeg   2014-11-26 20:04:48.466295490 +0100
+++ tests/data/fate/lavf-yuv4mpeg   2014-11-27 04:16:07.234916526 +0100
@@ -1,2 +0,0 @@
-ec8178cb152f9cdbfd9cb724d977db2e *./tests/data/lavf/lavf.y4m
-3801808 ./tests/data/lavf/lavf.y4m
Test lavf-yuv4mpeg failed. Look at tests/data/fate/lavf-yuv4mpeg.err for 
details.
make: *** [fate-lavf-yuv4mpeg] Error 139


I will rerun whole fate, but I assume I can push it if nothing fails?
The one mentioned above is OK.

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


Re: [FFmpeg-devel] [PATCH 2/2] lavc/options: fix leaks in avcodec_copy_context

2014-12-02 Thread Lukasz Marek
On 27 November 2014 at 17:56, Lukasz Marek lukasz.m.lu...@gmail.com wrote:

 On 27 November 2014 at 04:17, Michael Niedermayer michae...@gmx.at
 wrote:

 On Thu, Nov 27, 2014 at 12:43:57AM +0100, Lukasz Marek wrote:
  On 24.11.2014 05:16, Lukasz Marek wrote:
  Signed-off-by: Lukasz Marek lukasz.m.lu...@gmail.com
  ---
libavcodec/options.c | 23 +++
1 file changed, 11 insertions(+), 12 deletions(-)
  
  diff --git a/libavcodec/options.c b/libavcodec/options.c
  index 7f9fb07..8ba997c 100644
  --- a/libavcodec/options.c
  +++ b/libavcodec/options.c
  @@ -190,6 +190,11 @@ int avcodec_copy_context(AVCodecContext *dest,
 const AVCodecContext *src)
}
  
av_opt_free(dest);
  +av_freep(dest-rc_override);
  +av_freep(dest-intra_matrix);
  +av_freep(dest-inter_matrix);
  +av_freep(dest-extradata);
  +av_freep(dest-subtitle_header);
  
memcpy(dest, src, sizeof(*dest));
av_opt_copy(dest, src);
  @@ -205,13 +210,7 @@ int avcodec_copy_context(AVCodecContext *dest,
 const AVCodecContext *src)
dest-slice_offset= NULL;
dest-hwaccel = NULL;
dest-internal= NULL;
  -
  -/* reallocate values that should be allocated separately */
  -dest-extradata   = NULL;
  -dest-intra_matrix= NULL;
  -dest-inter_matrix= NULL;
  -dest-rc_override = NULL;
  -dest-subtitle_header = NULL;
 
 
  This should stay. Updated version attched
 

   options.c |   16 +++-
   1 file changed, 11 insertions(+), 5 deletions(-)
  971d1769e50d2e853d7359003f8c924092a96e6b
 0001-lavc-options-fix-leaks-in-avcodec_copy_context.patch
  From 722d7e837093212d6e6e6b17814ed408300d25a6 Mon Sep 17 00:00:00 2001
  From: Lukasz Marek lukasz.m.lu...@gmail.com
  Date: Thu, 27 Nov 2014 00:41:16 +0100
  Subject: [PATCH] lavc/options: fix leaks in avcodec_copy_context
 
  Signed-off-by: Lukasz Marek lukasz.m.lu...@gmail.com
  ---
   libavcodec/options.c | 16 +++-
   1 file changed, 11 insertions(+), 5 deletions(-)

 breaks make fate-lavf-yuv4mpeg

 --- ./tests/ref/lavf/yuv4mpeg   2014-11-26 20:04:48.466295490 +0100
 +++ tests/data/fate/lavf-yuv4mpeg   2014-11-27 04:16:07.234916526
 +0100
 @@ -1,2 +0,0 @@
 -ec8178cb152f9cdbfd9cb724d977db2e *./tests/data/lavf/lavf.y4m
 -3801808 ./tests/data/lavf/lavf.y4m
 Test lavf-yuv4mpeg failed. Look at tests/data/fate/lavf-yuv4mpeg.err for
 details.
 make: *** [fate-lavf-yuv4mpeg] Error 139


 This is because ffmpeg copy opened codec context and assumes copy is also
 opened, but this is against docs:

 Copy the settings of the source AVCodecContext into the destination
 AVCodecContext. The resulting destination codec context will be
 unopened, i.e. you are required to call avcodec_open2() before you
 can use this AVCodecContext to decode/encode video/audio data.

 I will push a patch for ffmpeg later and this patch have to be cleary
 postponed until ffmpeg is fixed.


I have sent patch for ffmpeg. It is not failing after that change.
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [PATCH 2/2] lavc/options: fix leaks in avcodec_copy_context

2014-11-27 Thread Lukasz Marek
On 27 November 2014 at 04:17, Michael Niedermayer michae...@gmx.at wrote:

 On Thu, Nov 27, 2014 at 12:43:57AM +0100, Lukasz Marek wrote:
  On 24.11.2014 05:16, Lukasz Marek wrote:
  Signed-off-by: Lukasz Marek lukasz.m.lu...@gmail.com
  ---
libavcodec/options.c | 23 +++
1 file changed, 11 insertions(+), 12 deletions(-)
  
  diff --git a/libavcodec/options.c b/libavcodec/options.c
  index 7f9fb07..8ba997c 100644
  --- a/libavcodec/options.c
  +++ b/libavcodec/options.c
  @@ -190,6 +190,11 @@ int avcodec_copy_context(AVCodecContext *dest,
 const AVCodecContext *src)
}
  
av_opt_free(dest);
  +av_freep(dest-rc_override);
  +av_freep(dest-intra_matrix);
  +av_freep(dest-inter_matrix);
  +av_freep(dest-extradata);
  +av_freep(dest-subtitle_header);
  
memcpy(dest, src, sizeof(*dest));
av_opt_copy(dest, src);
  @@ -205,13 +210,7 @@ int avcodec_copy_context(AVCodecContext *dest,
 const AVCodecContext *src)
dest-slice_offset= NULL;
dest-hwaccel = NULL;
dest-internal= NULL;
  -
  -/* reallocate values that should be allocated separately */
  -dest-extradata   = NULL;
  -dest-intra_matrix= NULL;
  -dest-inter_matrix= NULL;
  -dest-rc_override = NULL;
  -dest-subtitle_header = NULL;
 
 
  This should stay. Updated version attched
 

   options.c |   16 +++-
   1 file changed, 11 insertions(+), 5 deletions(-)
  971d1769e50d2e853d7359003f8c924092a96e6b
 0001-lavc-options-fix-leaks-in-avcodec_copy_context.patch
  From 722d7e837093212d6e6e6b17814ed408300d25a6 Mon Sep 17 00:00:00 2001
  From: Lukasz Marek lukasz.m.lu...@gmail.com
  Date: Thu, 27 Nov 2014 00:41:16 +0100
  Subject: [PATCH] lavc/options: fix leaks in avcodec_copy_context
 
  Signed-off-by: Lukasz Marek lukasz.m.lu...@gmail.com
  ---
   libavcodec/options.c | 16 +++-
   1 file changed, 11 insertions(+), 5 deletions(-)

 breaks make fate-lavf-yuv4mpeg

 --- ./tests/ref/lavf/yuv4mpeg   2014-11-26 20:04:48.466295490 +0100
 +++ tests/data/fate/lavf-yuv4mpeg   2014-11-27 04:16:07.234916526 +0100
 @@ -1,2 +0,0 @@
 -ec8178cb152f9cdbfd9cb724d977db2e *./tests/data/lavf/lavf.y4m
 -3801808 ./tests/data/lavf/lavf.y4m
 Test lavf-yuv4mpeg failed. Look at tests/data/fate/lavf-yuv4mpeg.err for
 details.
 make: *** [fate-lavf-yuv4mpeg] Error 139


This is because ffmpeg copy opened codec context and assumes copy is also
opened, but this is against docs:

Copy the settings of the source AVCodecContext into the destination
AVCodecContext. The resulting destination codec context will be
unopened, i.e. you are required to call avcodec_open2() before you
can use this AVCodecContext to decode/encode video/audio data.

I will push a patch for ffmpeg later and this patch have to be cleary
postponed until ffmpeg is fixed.
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [PATCH 2/2] lavc/options: fix leaks in avcodec_copy_context

2014-11-26 Thread Lukasz Marek

On 24.11.2014 05:16, Lukasz Marek wrote:

Signed-off-by: Lukasz Marek lukasz.m.lu...@gmail.com
---
  libavcodec/options.c | 23 +++
  1 file changed, 11 insertions(+), 12 deletions(-)

diff --git a/libavcodec/options.c b/libavcodec/options.c
index 7f9fb07..8ba997c 100644
--- a/libavcodec/options.c
+++ b/libavcodec/options.c
@@ -190,6 +190,11 @@ int avcodec_copy_context(AVCodecContext *dest, const 
AVCodecContext *src)
  }

  av_opt_free(dest);
+av_freep(dest-rc_override);
+av_freep(dest-intra_matrix);
+av_freep(dest-inter_matrix);
+av_freep(dest-extradata);
+av_freep(dest-subtitle_header);

  memcpy(dest, src, sizeof(*dest));
  av_opt_copy(dest, src);
@@ -205,13 +210,7 @@ int avcodec_copy_context(AVCodecContext *dest, const 
AVCodecContext *src)
  dest-slice_offset= NULL;
  dest-hwaccel = NULL;
  dest-internal= NULL;
-
-/* reallocate values that should be allocated separately */
-dest-extradata   = NULL;
-dest-intra_matrix= NULL;
-dest-inter_matrix= NULL;
-dest-rc_override = NULL;
-dest-subtitle_header = NULL;



This should stay. Updated version attched

From 722d7e837093212d6e6e6b17814ed408300d25a6 Mon Sep 17 00:00:00 2001
From: Lukasz Marek lukasz.m.lu...@gmail.com
Date: Thu, 27 Nov 2014 00:41:16 +0100
Subject: [PATCH] lavc/options: fix leaks in avcodec_copy_context

Signed-off-by: Lukasz Marek lukasz.m.lu...@gmail.com
---
 libavcodec/options.c | 16 +++-
 1 file changed, 11 insertions(+), 5 deletions(-)

diff --git a/libavcodec/options.c b/libavcodec/options.c
index 7698434..d637a14 100644
--- a/libavcodec/options.c
+++ b/libavcodec/options.c
@@ -190,6 +190,11 @@ int avcodec_copy_context(AVCodecContext *dest, const AVCodecContext *src)
 }
 
 av_opt_free(dest);
+av_freep(dest-rc_override);
+av_freep(dest-intra_matrix);
+av_freep(dest-inter_matrix);
+av_freep(dest-extradata);
+av_freep(dest-subtitle_header);
 
 memcpy(dest, src, sizeof(*dest));
 av_opt_copy(dest, src);
@@ -205,6 +210,7 @@ int avcodec_copy_context(AVCodecContext *dest, const AVCodecContext *src)
 dest-slice_offset= NULL;
 dest-hwaccel = NULL;
 dest-internal= NULL;
+dest-coded_frame = NULL;
 
 /* reallocate values that should be allocated separately */
 dest-extradata   = NULL;
@@ -224,6 +230,7 @@ int avcodec_copy_context(AVCodecContext *dest, const AVCodecContext *src)
 }
 alloc_and_copy_or_fail(extradata,src-extradata_size,
FF_INPUT_BUFFER_PADDING_SIZE);
+dest-extradata_size  = src-extradata_size;
 alloc_and_copy_or_fail(intra_matrix, 64 * sizeof(int16_t), 0);
 alloc_and_copy_or_fail(inter_matrix, 64 * sizeof(int16_t), 0);
 alloc_and_copy_or_fail(rc_override,  src-rc_override_count * sizeof(*src-rc_override), 0);
@@ -238,11 +245,10 @@ fail:
 av_freep(dest-intra_matrix);
 av_freep(dest-inter_matrix);
 av_freep(dest-extradata);
-#if FF_API_MPV_OPT
-FF_DISABLE_DEPRECATION_WARNINGS
-av_freep(dest-rc_eq);
-FF_ENABLE_DEPRECATION_WARNINGS
-#endif
+av_freep(dest-subtitle_header);
+dest-subtitle_header_size = 0;
+dest-extradata_size = 0;
+av_opt_free(dest);
 return AVERROR(ENOMEM);
 }
 
-- 
1.9.1

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


Re: [FFmpeg-devel] [PATCH 2/2] lavc/options: fix leaks in avcodec_copy_context

2014-11-26 Thread Michael Niedermayer
On Thu, Nov 27, 2014 at 12:43:57AM +0100, Lukasz Marek wrote:
 On 24.11.2014 05:16, Lukasz Marek wrote:
 Signed-off-by: Lukasz Marek lukasz.m.lu...@gmail.com
 ---
   libavcodec/options.c | 23 +++
   1 file changed, 11 insertions(+), 12 deletions(-)
 
 diff --git a/libavcodec/options.c b/libavcodec/options.c
 index 7f9fb07..8ba997c 100644
 --- a/libavcodec/options.c
 +++ b/libavcodec/options.c
 @@ -190,6 +190,11 @@ int avcodec_copy_context(AVCodecContext *dest, const 
 AVCodecContext *src)
   }
 
   av_opt_free(dest);
 +av_freep(dest-rc_override);
 +av_freep(dest-intra_matrix);
 +av_freep(dest-inter_matrix);
 +av_freep(dest-extradata);
 +av_freep(dest-subtitle_header);
 
   memcpy(dest, src, sizeof(*dest));
   av_opt_copy(dest, src);
 @@ -205,13 +210,7 @@ int avcodec_copy_context(AVCodecContext *dest, const 
 AVCodecContext *src)
   dest-slice_offset= NULL;
   dest-hwaccel = NULL;
   dest-internal= NULL;
 -
 -/* reallocate values that should be allocated separately */
 -dest-extradata   = NULL;
 -dest-intra_matrix= NULL;
 -dest-inter_matrix= NULL;
 -dest-rc_override = NULL;
 -dest-subtitle_header = NULL;
 
 
 This should stay. Updated version attched
 

  options.c |   16 +++-
  1 file changed, 11 insertions(+), 5 deletions(-)
 971d1769e50d2e853d7359003f8c924092a96e6b  
 0001-lavc-options-fix-leaks-in-avcodec_copy_context.patch
 From 722d7e837093212d6e6e6b17814ed408300d25a6 Mon Sep 17 00:00:00 2001
 From: Lukasz Marek lukasz.m.lu...@gmail.com
 Date: Thu, 27 Nov 2014 00:41:16 +0100
 Subject: [PATCH] lavc/options: fix leaks in avcodec_copy_context
 
 Signed-off-by: Lukasz Marek lukasz.m.lu...@gmail.com
 ---
  libavcodec/options.c | 16 +++-
  1 file changed, 11 insertions(+), 5 deletions(-)

breaks make fate-lavf-yuv4mpeg

--- ./tests/ref/lavf/yuv4mpeg   2014-11-26 20:04:48.466295490 +0100
+++ tests/data/fate/lavf-yuv4mpeg   2014-11-27 04:16:07.234916526 +0100
@@ -1,2 +0,0 @@
-ec8178cb152f9cdbfd9cb724d977db2e *./tests/data/lavf/lavf.y4m
-3801808 ./tests/data/lavf/lavf.y4m
Test lavf-yuv4mpeg failed. Look at tests/data/fate/lavf-yuv4mpeg.err for 
details.
make: *** [fate-lavf-yuv4mpeg] Error 139

[...]

-- 
Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

Many that live deserve death. And some that die deserve life. Can you give
it to them? Then do not be too eager to deal out death in judgement. For
even the very wise cannot see all ends. -- Gandalf


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


[FFmpeg-devel] [PATCH 2/2] lavc/options: fix leaks in avcodec_copy_context

2014-11-23 Thread Lukasz Marek
Signed-off-by: Lukasz Marek lukasz.m.lu...@gmail.com
---
 libavcodec/options.c | 23 +++
 1 file changed, 11 insertions(+), 12 deletions(-)

diff --git a/libavcodec/options.c b/libavcodec/options.c
index 7f9fb07..8ba997c 100644
--- a/libavcodec/options.c
+++ b/libavcodec/options.c
@@ -190,6 +190,11 @@ int avcodec_copy_context(AVCodecContext *dest, const 
AVCodecContext *src)
 }
 
 av_opt_free(dest);
+av_freep(dest-rc_override);
+av_freep(dest-intra_matrix);
+av_freep(dest-inter_matrix);
+av_freep(dest-extradata);
+av_freep(dest-subtitle_header);
 
 memcpy(dest, src, sizeof(*dest));
 av_opt_copy(dest, src);
@@ -205,13 +210,7 @@ int avcodec_copy_context(AVCodecContext *dest, const 
AVCodecContext *src)
 dest-slice_offset= NULL;
 dest-hwaccel = NULL;
 dest-internal= NULL;
-
-/* reallocate values that should be allocated separately */
-dest-extradata   = NULL;
-dest-intra_matrix= NULL;
-dest-inter_matrix= NULL;
-dest-rc_override = NULL;
-dest-subtitle_header = NULL;
+dest-coded_frame = NULL;
 
 #define alloc_and_copy_or_fail(obj, size, pad) \
 if (src-obj  size  0) { \
@@ -224,6 +223,7 @@ int avcodec_copy_context(AVCodecContext *dest, const 
AVCodecContext *src)
 }
 alloc_and_copy_or_fail(extradata,src-extradata_size,
FF_INPUT_BUFFER_PADDING_SIZE);
+dest-extradata_size  = src-extradata_size;
 alloc_and_copy_or_fail(intra_matrix, 64 * sizeof(int16_t), 0);
 alloc_and_copy_or_fail(inter_matrix, 64 * sizeof(int16_t), 0);
 alloc_and_copy_or_fail(rc_override,  src-rc_override_count * 
sizeof(*src-rc_override), 0);
@@ -238,11 +238,10 @@ fail:
 av_freep(dest-intra_matrix);
 av_freep(dest-inter_matrix);
 av_freep(dest-extradata);
-#if FF_API_MPV_OPT
-FF_DISABLE_DEPRECATION_WARNINGS
-av_freep(dest-rc_eq);
-FF_ENABLE_DEPRECATION_WARNINGS
-#endif
+av_freep(dest-subtitle_header);
+dest-subtitle_header_size = 0;
+dest-extradata_size = 0;
+av_opt_free(dest);
 return AVERROR(ENOMEM);
 }
 
-- 
1.9.1

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


Re: [FFmpeg-devel] [PATCH 2/2] lavc/options: fix leaks in avcodec_copy_context

2014-11-23 Thread Lukasz Marek
On 24-Nov-2014 5:17 am, Lukasz Marek lukasz.m.lu...@gmail.com wrote:

 Signed-off-by: Lukasz Marek lukasz.m.lu...@gmail.com
 ---
  libavcodec/options.c | 23 +++
  1 file changed, 11 insertions(+), 12 deletions(-)

 diff --git a/libavcodec/options.c b/libavcodec/options.c
 index 7f9fb07..8ba997c 100644
 --- a/libavcodec/options.c
 +++ b/libavcodec/options.c
 @@ -190,6 +190,11 @@ int avcodec_copy_context(AVCodecContext *dest, const
AVCodecContext *src)
  }

  av_opt_free(dest);
 +av_freep(dest-rc_override);
 +av_freep(dest-intra_matrix);
 +av_freep(dest-inter_matrix);
 +av_freep(dest-extradata);
 +av_freep(dest-subtitle_header);

  memcpy(dest, src, sizeof(*dest));
  av_opt_copy(dest, src);
 @@ -205,13 +210,7 @@ int avcodec_copy_context(AVCodecContext *dest, const
AVCodecContext *src)
  dest-slice_offset= NULL;
  dest-hwaccel = NULL;
  dest-internal= NULL;
 -
 -/* reallocate values that should be allocated separately */
 -dest-extradata   = NULL;
 -dest-intra_matrix= NULL;
 -dest-inter_matrix= NULL;
 -dest-rc_override = NULL;
 -dest-subtitle_header = NULL;

This assignments should stay in case of copy error below.
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel