[vlc-devel] commit: RC OSD: Fix NULL check after deref (CID 109) ( Rémi Denis-Courmont )
git version control
git at videolan.org
Sun Jun 1 11:10:06 CEST 2008
vlc | branch: 0.8.6-bugfix | Rémi Denis-Courmont <rdenis at simphalempin.com> | Sun Jun 1 12:11:42 2008 +0300| [a2d82490555eb3271a77b4958bc8528091951901]
RC OSD: Fix NULL check after deref (CID 109)
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=a2d82490555eb3271a77b4958bc8528091951901
---
modules/control/rc.c | 15 ++++++++-------
1 files changed, 8 insertions(+), 7 deletions(-)
diff --git a/modules/control/rc.c b/modules/control/rc.c
index 15f1913..78c8569 100644
--- a/modules/control/rc.c
+++ b/modules/control/rc.c
@@ -2165,14 +2165,14 @@ static int Menu( vlc_object_t *p_this, char const *psz_cmd,
{
intf_thread_t *p_intf = (intf_thread_t*)p_this;
playlist_t *p_playlist = NULL;
+ int i_error = VLC_SUCCESS;
vlc_value_t val;
- int i_error = VLC_EGENERIC;
if ( !*newval.psz_string )
{
msg_rc( _("Please provide one of the following parameters:") );
msg_rc( "[on|off|up|down|left|right|select]" );
- return i_error;
+ return VLC_EGENERIC;
}
p_playlist = vlc_object_find( p_this, VLC_OBJECT_PLAYLIST, FIND_ANYWHERE );
@@ -2193,9 +2193,12 @@ static int Menu( vlc_object_t *p_this, char const *psz_cmd,
vlc_object_release( p_playlist );
val.psz_string = strdup( newval.psz_string );
+ if( !val.psz_string )
+ return VLC_ENOMEM;
if( !strcmp( val.psz_string, "on" ) || !strcmp( val.psz_string, "show" ))
osd_MenuShow( p_this );
- else if( !strcmp( val.psz_string, "off" ) || !strcmp( val.psz_string, "hide" ) )
+ else if( !strcmp( val.psz_string, "off" )
+ || !strcmp( val.psz_string, "hide" ) )
osd_MenuHide( p_this );
else if( !strcmp( val.psz_string, "up" ) )
osd_MenuUp( p_this );
@@ -2211,12 +2214,10 @@ static int Menu( vlc_object_t *p_this, char const *psz_cmd,
{
msg_rc( _("Please provide one of the following parameters:") );
msg_rc( "[on|off|up|down|left|right|select]" );
- if( val.psz_string ) free( val.psz_string );
- return i_error;
+ i_error = VLC_EGENERIC;
}
- i_error = VLC_SUCCESS;
- if( val.psz_string ) free( val.psz_string );
+ free( val.psz_string );
return i_error;
}
More information about the vlc-devel
mailing list