On 23/02/15 16:02, Andreas Cadhalpun wrote:
On 23.02.2015 12:46, Luca Barbato wrote:
On 23/02/15 12:23, Andreas Cadhalpun wrote:
On 23.02.2015 01:56, Michael Niedermayer wrote:
--- a/libavcodec/a64multienc.c
+++ b/libavcodec/a64multienc.c
@@ -317,7 +317,9 @@ static int a64multi_encode_frame(AVCodecContext
*avctx, AVPacket *pkt,
      } else {
          /* fill up mc_meta_charset with data until lifetime
exceeds */
          if (c->mc_frame_counter < c->mc_lifetime) {
-            *p = *pict;
+            ret = av_frame_ref(p, pict);
+            if (ret < 0)
+                return ret;

I suspect this leaves a memleak, ill push it anyway as it allows
regression testing the more complex subsequent fix

Yes, this trades the crash for a memleak. :-/
Your simplification [1] fixes that.


coded_frame should be always allocated if I remember correctly and a
cursory git grep tells me that.

Why should coded_frame be allocated? Is this documented somewhere?

In the doxygen documentation.

It seems many audio encoders don't do that, as well as e.g.
libopenh264enc and libwebpenc.

Either the documentation or the encoders should be fixed.

Anyway, the memleak can also be fixed by adding av_frame_unref(p) before
the av_frame_ref.

I was guessing right then =)

lu

_______________________________________________
libav-devel mailing list
[email protected]
https://lists.libav.org/mailman/listinfo/libav-devel

Reply via email to