[vlc-commits] lua: fix leaks

Rémi Denis-Courmont git at videolan.org
Sun Apr 12 15:17:20 CEST 2020


vlc | branch: master | Rémi Denis-Courmont <remi at remlab.net> | Sun Apr 12 16:15:46 2020 +0300| [8a53887fbf61cf25be35fd776d3de5197f4e00af] | committer: Rémi Denis-Courmont

lua: fix leaks

All string-class variables must be freed, not just the string-typed
ones.

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=8a53887fbf61cf25be35fd776d3de5197f4e00af
---

 modules/lua/libs/variables.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/modules/lua/libs/variables.c b/modules/lua/libs/variables.c
index 21e300cd16..a6586a07b0 100644
--- a/modules/lua/libs/variables.c
+++ b/modules/lua/libs/variables.c
@@ -143,7 +143,7 @@ static int vlclua_var_inherit( lua_State *L )
 
     lua_pop( L, 2 );
     vlclua_pushvalue( L, i_type, val );
-    if( i_type == VLC_VAR_STRING )
+    if( (i_type & VLC_VAR_CLASS) == VLC_VAR_STRING )
         free( val.psz_string );
     return 1;
 }
@@ -160,7 +160,7 @@ static int vlclua_var_get( lua_State *L )
 
     lua_pop( L, 2 );
     vlclua_pushvalue( L, i_type, val );
-    if( i_type == VLC_VAR_STRING )
+    if( (i_type & VLC_VAR_CLASS) == VLC_VAR_STRING )
         free( val.psz_string );
     return 1;
 }



More information about the vlc-commits mailing list