]> git.sesse.net Git - vlc/commitdiff
MKV: fix a memory leak
authorSteve Lhomme <robUx4@videolabs.io>
Mon, 16 Mar 2015 13:13:09 +0000 (13:13 +0000)
committerJean-Baptiste Kempf <jb@videolan.org>
Tue, 17 Mar 2015 17:15:29 +0000 (18:15 +0100)
Signed-off-by: Jean-Baptiste Kempf <jb@videolan.org>
modules/demux/mkv/mkv.cpp

index 459328ea8b3d86c325d9ef91bcdadb65e4265e93..5cace0a984cbf9f6bb944b8905bc47ebfa4c682b 100644 (file)
@@ -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 );
                         }
                     }
                 }