On 17/02/15 17:51, Vittorio Giovara wrote:
On Tue, Feb 17, 2015 at 10:12 AM,  <[email protected]> wrote:
From: Federico Tomassetti <[email protected]>

Bug-Id: CID 1257787
---
  libavformat/mpegenc.c | 2 ++
  1 file changed, 2 insertions(+)

diff --git a/libavformat/mpegenc.c b/libavformat/mpegenc.c
index fd3bbec..77aea2f 100644
--- a/libavformat/mpegenc.c
+++ b/libavformat/mpegenc.c
@@ -1099,6 +1099,8 @@ static int mpeg_mux_write_packet(AVFormatContext *ctx, 
AVPacket *pkt)
          stream->next_packet = &stream->premux_packet;
      *stream->next_packet     =
      pkt_desc                 = av_mallocz(sizeof(PacketDesc));
+    if (!pkt_desc)
+        return AVERROR(ENOMEM);
      pkt_desc->pts            = pts;
      pkt_desc->dts            = dts;
      pkt_desc->unwritten_size =

ok

Not ok...

Explanations:

the write_packet can be called again so nulling the pointer to the next packet (the whole thing is a little confusing linked list) would end up giving you a memory leak, see my patch from the last month.

Shame on me for not pushing it.

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

Reply via email to