Commit 2e6d37ed authored by Jean-Paul Saman's avatar Jean-Paul Saman

Fix potential memleak.

parent 250b5a41
...@@ -1289,7 +1289,6 @@ void update_download_for_real( download_thread_t *p_this ) ...@@ -1289,7 +1289,6 @@ void update_download_for_real( download_thread_t *p_this )
} }
else else
{ {
p_file = utf8_fopen( psz_dest, "w" ); p_file = utf8_fopen( psz_dest, "w" );
if( !p_file ) if( !p_file )
{ {
...@@ -1305,7 +1304,8 @@ void update_download_for_real( download_thread_t *p_this ) ...@@ -1305,7 +1304,8 @@ void update_download_for_real( download_thread_t *p_this )
l_size = stream_Size(p_stream); l_size = stream_Size(p_stream);
p_buffer = (void *)malloc( 1<<10 ); p_buffer = (void *)malloc( 1<<10 );
if( p_buffer )
{
while( ( l_read = stream_Read( p_stream, p_buffer, 1<<10 ) ) ) while( ( l_read = stream_Read( p_stream, p_buffer, 1<<10 ) ) )
{ {
float f_progress; float f_progress;
...@@ -1319,13 +1319,15 @@ void update_download_for_real( download_thread_t *p_this ) ...@@ -1319,13 +1319,15 @@ void update_download_for_real( download_thread_t *p_this )
psz_s2 = size_str( l_size ); psz_s2 = size_str( l_size );
asprintf( &psz_status, "%s\nDownloading... %s/%s (%.1f%%) done", asprintf( &psz_status, "%s\nDownloading... %s/%s (%.1f%%) done",
p_this->psz_status, psz_s1, psz_s2, f_progress ); p_this->psz_status, psz_s1, psz_s2, f_progress );
free( psz_s1 ); free( psz_s2 ); free( psz_s1 );
free( psz_s2 );
intf_ProgressUpdate( p_libvlc, i_progress, intf_ProgressUpdate( p_libvlc, i_progress,
psz_status, f_progress, 0 ); psz_status, f_progress, 0 );
} }
free( p_buffer ); free( p_buffer );
}
fclose( p_file ); fclose( p_file );
stream_Delete( p_stream ); stream_Delete( p_stream );
......
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