[vlc-devel] [PATCH 2/3] Lua: fix memory leaks of string variables

Rémi Denis-Courmont remi at remlab.net
Sat Mar 14 11:28:45 CET 2015


Le 2015-03-13 21:34, Hannes Domani a écrit :
> Is this the correct check for a string to free after var_Get()?:
>
>  if( ( i_type & VLC_VAR_CLASS ) == VLC_VAR_STRING )
>    free( val.psz_string );

No. Never mix variables types, and preferably use type-safe macros. We 
do not provide a generic function for freeing variable value.

-- 
Rémi Denis-Courmont



More information about the vlc-devel mailing list