[vlc-commits] MKV: fix a memory leak

Steve Lhomme git at videolan.org
Tue Mar 17 18:21:49 CET 2015


vlc | branch: master | Steve Lhomme <robUx4 at videolabs.io> | Mon Mar 16 13:13:09 2015 +0000| [bea81bc163f7b401068003977bf23a3aa675d2da] | committer: Jean-Baptiste Kempf

MKV: fix a memory leak

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

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

 modules/demux/mkv/mkv.cpp |    6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/modules/demux/mkv/mkv.cpp b/modules/demux/mkv/mkv.cpp
index 459328e..5cace0a 100644
--- a/modules/demux/mkv/mkv.cpp
+++ b/modules/demux/mkv/mkv.cpp
@@ -192,11 +192,10 @@ static int Open( vlc_object_t * p_this )
                             // test whether this file belongs to our family
                             const uint8_t *p_peek;
                             bool          file_ok = false;
-#warning Memory leak!
-                            std::string   s_url = vlc_path2uri( s_filename.c_str(), "file" );
+                            char          *psz_url = vlc_path2uri( s_filename.c_str(), "file" );
                             stream_t      *p_file_stream = stream_UrlNew(
                                                             p_demux,
-                                                            s_url.c_str() );
+                                                            psz_url );
                             /* peek the begining */
                             if( p_file_stream &&
                                 stream_Peek( p_file_stream, &p_peek, 4 ) >= 4
@@ -230,6 +229,7 @@ static int Open( vlc_object_t * p_this )
                                 }
                                 msg_Dbg( p_demux, "the file '%s' cannot be opened", s_filename.c_str() );
                             }
+                            free( psz_url );
                         }
                     }
                 }



More information about the vlc-commits mailing list