From: Jean-Baptiste Kempf Date: Mon, 25 Feb 2008 09:24:55 +0000 (+0000) Subject: Update - avoid a segfault if the error is triggered before hd creation. X-Git-Tag: 0.9.0-test0~2531 X-Git-Url: https://git.sesse.net/?a=commitdiff_plain;ds=sidebyside;h=761886e8e4ca206d5058bc9d259061141249ae2f;p=vlc Update - avoid a segfault if the error is triggered before hd creation. --- diff --git a/src/misc/update.c b/src/misc/update.c index 6b6088b075..513888f16c 100644 --- a/src/misc/update.c +++ b/src/misc/update.c @@ -1034,7 +1034,7 @@ static vlc_bool_t GetUpdateFile( update_t *p_update ) gcry_md_hd_t hd; 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 ) ); FREENULL( psz_version_line ); @@ -1063,14 +1063,14 @@ static vlc_bool_t GetUpdateFile( update_t *p_update ) p_hash[1] != sign.hash_verification[1] ) { 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 ) != VLC_SUCCESS ) { msg_Err( p_update->p_libvlc, "BAD SIGNATURE for status file" ); - goto error; + goto error_hd; } else { @@ -1079,8 +1079,9 @@ static vlc_bool_t GetUpdateFile( update_t *p_update ) return VLC_TRUE; } -error: +error_hd: gcry_md_close( hd ); +error: if( p_stream ) stream_Delete( p_stream ); free( psz_version_line );