[vlc-commits] dash: Fixing SegmentInfoCommon initialization/deletion.

Hugo Beauzée-Luyssen git at videolan.org
Tue Jan 24 23:22:02 CET 2012


vlc/vlc-1.2 | branch: master | Hugo Beauzée-Luyssen <beauze.h at gmail.com> | Thu Jan  5 18:21:37 2012 +0100| [8b5f1ac1cccdc61528a98b6bdbedcafd5984212c] | committer: Jean-Baptiste Kempf

dash: Fixing SegmentInfoCommon initialization/deletion.

This prevents a potential crash, and solves a memory leak.

Signed-off-by: Jean-Baptiste Kempf <jb at videolan.org>
(cherry picked from commit 83b82fc3805b1217cb6204fc4f763550416f0de0)

Signed-off-by: Jean-Baptiste Kempf <jb at videolan.org>

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

 .../stream_filter/dash/mpd/SegmentInfoCommon.cpp   |   13 ++++++++++++-
 modules/stream_filter/dash/mpd/SegmentInfoCommon.h |    1 +
 2 files changed, 13 insertions(+), 1 deletions(-)

diff --git a/modules/stream_filter/dash/mpd/SegmentInfoCommon.cpp b/modules/stream_filter/dash/mpd/SegmentInfoCommon.cpp
index 0d7c26b..51f3519 100644
--- a/modules/stream_filter/dash/mpd/SegmentInfoCommon.cpp
+++ b/modules/stream_filter/dash/mpd/SegmentInfoCommon.cpp
@@ -24,11 +24,22 @@
 
 #include "SegmentInfoCommon.h"
 
+#include "Segment.h"
+#include "SegmentTimeline.h"
+
 using namespace dash::mpd;
 
 SegmentInfoCommon::SegmentInfoCommon() :
-    duration( -1 )
+    duration( -1 ),
+    initialisationSegment( NULL ),
+    segmentTimeline( NULL )
+{
+}
+
+SegmentInfoCommon::~SegmentInfoCommon()
 {
+    delete this->segmentTimeline;
+    delete this->initialisationSegment;
 }
 
 time_t      SegmentInfoCommon::getDuration() const
diff --git a/modules/stream_filter/dash/mpd/SegmentInfoCommon.h b/modules/stream_filter/dash/mpd/SegmentInfoCommon.h
index 654ebfc..d637c4e 100644
--- a/modules/stream_filter/dash/mpd/SegmentInfoCommon.h
+++ b/modules/stream_filter/dash/mpd/SegmentInfoCommon.h
@@ -39,6 +39,7 @@ namespace dash
         {
             public:
                 SegmentInfoCommon();
+                virtual ~SegmentInfoCommon();
                 time_t                  getDuration() const;
                 void                    setDuration( time_t duration );
                 int                     getStartIndex() const;



More information about the vlc-commits mailing list