[vlc-commits] ogg: fix memory-leaks in muxer

Filip Roséen git at videolan.org
Mon Sep 5 18:34:38 CEST 2016


vlc | branch: master | Filip Roséen <filip at atch.se> | Thu Sep  1 05:59:06 2016 +0200| [ef346641284a0a1dbf313e69cf0911a07f753e88] | committer: Thomas Guillem

ogg: fix memory-leaks in muxer

In order to clean up the dynamically allocated resources owned by an
ogg_packet, ogg_packet_clear should be called.

 - https://xiph.org/ogg/doc/libogg/ogg_packet_clear

closes #17334

Signed-off-by: Thomas Guillem <thomas at gllm.fr>

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=ef346641284a0a1dbf313e69cf0911a07f753e88
---

 modules/mux/ogg.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/modules/mux/ogg.c b/modules/mux/ogg.c
index 45b6846..03789b7 100644
--- a/modules/mux/ogg.c
+++ b/modules/mux/ogg.c
@@ -985,6 +985,7 @@ static bool OggCreateHeaders( sout_mux_t *p_mux )
         op.packetno = 0;
         OggFillSkeletonFishead( op.packet, p_mux );
         ogg_stream_packetin( &p_sys->skeleton.os, &op );
+        ogg_packet_clear( &op );
         p_og = OggStreamFlush( p_mux, &p_sys->skeleton.os, 0 );
         block_ChainAppend( &p_hdr, p_og );
         p_sys->skeleton.b_head_done = true;
@@ -1126,6 +1127,7 @@ static bool OggCreateHeaders( sout_mux_t *p_mux )
             op.granulepos = 0;
             op.packetno = p_sys->skeleton.i_packet_no++;
             ogg_stream_packetin( &p_sys->skeleton.os, &op );
+            ogg_packet_clear( &op );
             p_og = OggStreamFlush( p_mux, &p_sys->skeleton.os, 0 );
             block_ChainAppend( &p_hdr, p_og );
             p_stream->skeleton.b_fisbone_done = true;
@@ -1166,6 +1168,7 @@ static bool OggCreateHeaders( sout_mux_t *p_mux )
                 p_stream->skeleton.i_index_pageno = p_sys->skeleton.os.pageno;
 
                 ogg_stream_packetin( &p_sys->skeleton.os, &op );
+                ogg_packet_clear( &op );
                 p_og = OggStreamFlush( p_mux, &p_sys->skeleton.os, 0 );
                 p_mux->p_sys->i_pos += sout_AccessOutWrite( p_mux->p_access, p_og );
             }
@@ -1331,6 +1334,7 @@ static void OggCreateStreamFooter( sout_mux_t *p_mux, ogg_stream_t *p_stream )
             p_sys->skeleton.os.b_o_s = 1;
             p_sys->skeleton.os.e_o_s = 0;
             ogg_stream_packetin( &p_sys->skeleton.os, &op );
+            ogg_packet_clear( &op );
             p_og = OggStreamFlush( p_mux, &p_sys->skeleton.os, 0 );
             sout_AccessOutWrite( p_mux->p_access, p_og );
         }
@@ -1407,6 +1411,7 @@ static void OggRewriteFisheadPage( sout_mux_t *p_mux )
         ogg_stream_reset_serialno( &p_sys->skeleton.os, p_sys->skeleton.i_serial_no );
         OggFillSkeletonFishead( op.packet, p_mux );
         ogg_stream_packetin( &p_sys->skeleton.os, &op );
+        ogg_packet_clear( &op );
         msg_Dbg( p_mux, "rewriting fishead at %"PRId64, p_mux->p_sys->skeleton.i_fishead_offset );
         sout_AccessOutSeek( p_mux->p_access, p_mux->p_sys->skeleton.i_fishead_offset );
         sout_AccessOutWrite( p_mux->p_access,



More information about the vlc-commits mailing list