mplex leak fix

Mark Nauwelaerts <[email protected]>
Newsgroups gmane.comp.video.mjpeg.devel
Message-ID <[email protected]>
Small patch attached, hardly grand or fancy;
just fixes a new [] / delete mismatch and some (superficial) memleaks in (lib)mplex.

Regards,
Mark.

-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys-and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV

_______________________________________________
Mjpeg-developer mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/mjpeg-developer
mplex.patch (text/x-patch, 1.5 KB)
Index: bits.cpp
===================================================================
RCS file: /cvsroot/mjpeg/mjpeg_play/mplex/bits.cpp,v
retrieving revision 1.8
diff -u -r1.8 bits.cpp
--- bits.cpp	12 Dec 2005 21:14:43 -0000	1.8
+++ bits.cpp	26 Mar 2007 19:40:28 -0000
@@ -57,7 +57,7 @@
 void BitStreamBuffering::Release()
 {
     if( bfr != 0)
-        delete bfr;
+        delete [] bfr;
     bfr = 0;
     bfr_size = 0;
     buffered = 0;
Index: multiplexor.cpp
===================================================================
RCS file: /cvsroot/mjpeg/mjpeg_play/mplex/multiplexor.cpp,v
retrieving revision 1.40
diff -u -r1.40 multiplexor.cpp
--- multiplexor.cpp	27 Feb 2007 22:48:18 -0000	1.40
+++ multiplexor.cpp	26 Mar 2007 19:40:29 -0000
@@ -57,6 +57,16 @@
     vdr_index = index;
 }
 
+Multiplexor::~Multiplexor()
+{
+    delete psstrm;
+    while (!estreams.empty()) {
+        delete estreams.back();
+        estreams.pop_back();
+    }
+    vstreams.clear();
+    astreams.clear();
+}
 
 /******************************************************************
  *
Index: multiplexor.hpp
===================================================================
RCS file: /cvsroot/mjpeg/mjpeg_play/mplex/multiplexor.hpp,v
retrieving revision 1.9
diff -u -r1.9 multiplexor.hpp
--- multiplexor.hpp	27 Feb 2007 22:48:18 -0000	1.9
+++ multiplexor.hpp	26 Mar 2007 19:40:29 -0000
@@ -14,6 +14,7 @@
 {
 public:
 	Multiplexor(MultiplexJob &job, OutputStream &output, OutputStream *index);
+        ~Multiplexor ();
 	void Multiplex ();
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.