[vlc-commits] [Git][videolan/vlc][master] 2 commits: lua: avoid pushing NULL strings
Steve Lhomme (@robUx4)
gitlab at videolan.org
Thu Jun 20 11:19:43 UTC 2024
Steve Lhomme pushed to branch master at VideoLAN / VLC
Commits:
a24e8d42 by Steve Lhomme at 2024-06-20T10:59:22+00:00
lua: avoid pushing NULL strings
We do not check for nil in the code and it's not clear if it's properly supported.
- - - - -
68f669fe by Steve Lhomme at 2024-06-20T10:59:22+00:00
variables: avoid creating an empty string to free it right after
var_InheritString() releases the memory and sets NULL when the string is empty.
- - - - -
2 changed files:
- modules/lua/libs/variables.c
- src/misc/variables.c
Changes:
=====================================
modules/lua/libs/variables.c
=====================================
@@ -67,7 +67,10 @@ static int vlclua_pushvalue( lua_State *L, int i_type, vlc_value_t val )
lua_pushinteger( L, val.i_int );
break;
case VLC_VAR_STRING:
- lua_pushstring( L, val.psz_string );
+ if (val.psz_string)
+ lua_pushstring( L, val.psz_string );
+ else
+ lua_pushstring( L, "" );
break;
case VLC_VAR_FLOAT:
lua_pushnumber( L, val.f_float );
=====================================
src/misc/variables.c
=====================================
@@ -1050,7 +1050,6 @@ int var_Inherit( vlc_object_t *p_this, const char *psz_name, int i_type,
{
case VLC_VAR_STRING:
p_val->psz_string = config_GetPsz( psz_name );
- if( !p_val->psz_string ) p_val->psz_string = strdup("");
break;
case VLC_VAR_FLOAT:
p_val->f_float = config_GetFloat( psz_name );
View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/900a4290b6ef251eccffadce02abda9bb0df5ad2...68f669feb50e9524475c09c20a51193f41eeacfc
--
This project does not include diff previews in email notifications.
View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/900a4290b6ef251eccffadce02abda9bb0df5ad2...68f669feb50e9524475c09c20a51193f41eeacfc
You're receiving this email because of your account on code.videolan.org.
VideoLAN code repository instance
More information about the vlc-commits
mailing list