Commit 761886e8 authored by Jean-Baptiste Kempf's avatar Jean-Baptiste Kempf

Update - avoid a segfault if the error is triggered before hd creation.

parent 868cd6a7
...@@ -1034,7 +1034,7 @@ static vlc_bool_t GetUpdateFile( update_t *p_update ) ...@@ -1034,7 +1034,7 @@ static vlc_bool_t GetUpdateFile( update_t *p_update )
gcry_md_hd_t hd; gcry_md_hd_t hd;
if( gcry_md_open( &hd, GCRY_MD_SHA1, 0 ) ) if( gcry_md_open( &hd, GCRY_MD_SHA1, 0 ) )
goto error; goto error_hd;
gcry_md_write( hd, psz_version_line, strlen( psz_version_line ) ); gcry_md_write( hd, psz_version_line, strlen( psz_version_line ) );
FREENULL( psz_version_line ); FREENULL( psz_version_line );
...@@ -1063,14 +1063,14 @@ static vlc_bool_t GetUpdateFile( update_t *p_update ) ...@@ -1063,14 +1063,14 @@ static vlc_bool_t GetUpdateFile( update_t *p_update )
p_hash[1] != sign.hash_verification[1] ) p_hash[1] != sign.hash_verification[1] )
{ {
msg_Warn( p_update->p_libvlc, "Bad SHA1 hash for status file" ); msg_Warn( p_update->p_libvlc, "Bad SHA1 hash for status file" );
goto error; goto error_hd;
} }
if( verify_signature( sign.r, sign.s, &p_update->p_pkey->key, p_hash ) if( verify_signature( sign.r, sign.s, &p_update->p_pkey->key, p_hash )
!= VLC_SUCCESS ) != VLC_SUCCESS )
{ {
msg_Err( p_update->p_libvlc, "BAD SIGNATURE for status file" ); msg_Err( p_update->p_libvlc, "BAD SIGNATURE for status file" );
goto error; goto error_hd;
} }
else else
{ {
...@@ -1079,8 +1079,9 @@ static vlc_bool_t GetUpdateFile( update_t *p_update ) ...@@ -1079,8 +1079,9 @@ static vlc_bool_t GetUpdateFile( update_t *p_update )
return VLC_TRUE; return VLC_TRUE;
} }
error: error_hd:
gcry_md_close( hd ); gcry_md_close( hd );
error:
if( p_stream ) if( p_stream )
stream_Delete( p_stream ); stream_Delete( p_stream );
free( psz_version_line ); free( psz_version_line );
......
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