Commit 2d9a2010 authored by Jean-Baptiste Kempf's avatar Jean-Baptiste Kempf

Qt: fix memleak

And avoid a strdup(""); free() for nothing
parent a05e7f35
...@@ -681,16 +681,23 @@ void DialogsProvider::loadSubtitlesFile() ...@@ -681,16 +681,23 @@ void DialogsProvider::loadSubtitlesFile()
input_item_t *p_item = input_GetItem( p_input ); input_item_t *p_item = input_GetItem( p_input );
if( !p_item ) return; if( !p_item ) return;
char *path = make_path( input_item_GetURI( p_item ) ); char *path = input_item_GetURI( p_item );
if( !path ) path = strdup( "" ); char *path2 = NULL;
if( path )
char *sep = strrchr( path, DIR_SEP_CHAR ); {
if( sep ) *sep = '\0'; path2 = make_path( path );
free( path );
if( path2 )
{
char *sep = strrchr( path2, DIR_SEP_CHAR );
if( sep ) *sep = '\0';
}
}
QStringList qsl = showSimpleOpen( qtr( "Open subtitles..." ), QStringList qsl = showSimpleOpen( qtr( "Open subtitles..." ),
EXT_FILTER_SUBTITLE, EXT_FILTER_SUBTITLE,
qfu( path ) ); qfu( path2 ) );
free( path ); free( path2 );
foreach( const QString &qsFile, qsl ) foreach( const QString &qsFile, qsl )
{ {
if( input_AddSubtitle( p_input, qtu( toNativeSeparators( qsFile ) ), if( input_AddSubtitle( p_input, qtu( toNativeSeparators( qsFile ) ),
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment