]> git.sesse.net Git - vlc/commitdiff
variables: fix a potential crash/double free.
authorRémi Duraffort <ivoire@videolan.org>
Tue, 19 May 2009 21:33:00 +0000 (23:33 +0200)
committerRémi Duraffort <ivoire@videolan.org>
Tue, 19 May 2009 21:33:00 +0000 (23:33 +0200)
Indeed, giving a NULL to var_Change(VLC_VAR_SETSTRING) will lead to a crash the
next time this variable is used.

src/misc/variables.c

index 1242431c222e59920bb2bc463dac9af9297ed504..f8bf3d8e951760f77f82c2bac06fa683677cc079 100644 (file)
@@ -623,6 +623,8 @@ int __var_Change( vlc_object_t *p_this, const char *psz_name,
             free( p_var->psz_text );
             if( p_val && p_val->psz_string )
                 p_var->psz_text = strdup( p_val->psz_string );
+            else
+                p_val->psz_text = NULL;
             break;
         case VLC_VAR_GETTEXT:
             p_val->psz_string = NULL;