[vlc-commits] lua: fix leaks

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


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

lua: fix leaks

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

(cherry picked from commit 8a53887fbf61cf25be35fd776d3de5197f4e00af)

> http://git.videolan.org/gitweb.cgi/vlc/vlc-3.0.git/?a=commit;h=9e238cd312c6b74ec264f45f070919344dd90e14
---

 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 76e4290f13..739d2eb707 100644
--- a/modules/lua/libs/variables.c
+++ b/modules/lua/libs/variables.c
@@ -160,7 +160,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;
 }
@@ -177,7 +177,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